diff options
author | geequlim <geequlim@gmail.com> | 2019-08-11 14:06:39 +0800 |
---|---|---|
committer | geequlim <geequlim@gmail.com> | 2019-08-11 14:06:39 +0800 |
commit | e5b91a15e64c84fdc1055f86414df4fb808e31fb (patch) | |
tree | 6e67cea80ef96c21f8d5c65e244de931cc1e275a /modules/gdscript/language_server | |
parent | 72d11cd17355585bd3f2b6d467ebb45ad55b6759 (diff) |
Improve code compeletion for virtual methods with signatures
Diffstat (limited to 'modules/gdscript/language_server')
-rw-r--r-- | modules/gdscript/language_server/gdscript_text_document.cpp | 2 | ||||
-rw-r--r-- | modules/gdscript/language_server/gdscript_workspace.cpp | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/modules/gdscript/language_server/gdscript_text_document.cpp b/modules/gdscript/language_server/gdscript_text_document.cpp index a79c082141..f211fae526 100644 --- a/modules/gdscript/language_server/gdscript_text_document.cpp +++ b/modules/gdscript/language_server/gdscript_text_document.cpp @@ -244,7 +244,7 @@ Dictionary GDScriptTextDocument::resolve(const Dictionary &p_params) { item.documentation = symbol->render(); } - if (item.kind == lsp::CompletionItemKind::Method || item.kind == lsp::CompletionItemKind::Function) { + if ((item.kind == lsp::CompletionItemKind::Method || item.kind == lsp::CompletionItemKind::Function) && !item.label.ends_with("):")) { item.insertText = item.label + "("; if (symbol && symbol->detail.find(",") == -1) { item.insertText += ")"; diff --git a/modules/gdscript/language_server/gdscript_workspace.cpp b/modules/gdscript/language_server/gdscript_workspace.cpp index 6de02671a4..1901daacff 100644 --- a/modules/gdscript/language_server/gdscript_workspace.cpp +++ b/modules/gdscript/language_server/gdscript_workspace.cpp @@ -382,6 +382,11 @@ const lsp::DocumentSymbol *GDScriptWorkspace::resolve_symbol(const lsp::TextDocu if (const ExtendGDScriptParser *parser = get_parse_result(path)) { String symbol_identifier = p_symbol_name; + Vector<String> identifier_parts = symbol_identifier.split("("); + if (identifier_parts.size()) { + symbol_identifier = identifier_parts[0]; + } + lsp::Position pos = p_doc_pos.position; if (symbol_identifier.empty()) { Vector2i offset; |