Просмотр исходного кода

Improve code compeletion for virtual methods with signatures

geequlim 6 лет назад
Родитель
Сommit
e5b91a15e6

+ 1 - 1
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 += ")";

+ 5 - 0
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;