Browse Source

Merge pull request #105415 from HolonProduction/hardcoded-braces

Autocompletion: Remove additional parenthesis from utility function options
Thaddeus Crews 3 months ago
parent
commit
83d98f02e3

+ 0 - 1
modules/gdscript/gdscript_editor.cpp

@@ -1524,7 +1524,6 @@ static void _find_identifiers(const GDScriptParser::CompletionContext &p_context
 
 	for (const StringName &util_func_name : utility_func_names) {
 		ScriptLanguage::CodeCompletionOption option(util_func_name, ScriptLanguage::CODE_COMPLETION_KIND_FUNCTION);
-		option.insert_text += "(";
 		if (p_add_braces) {
 			option.insert_text += "(";
 			option.display += U"(\u2026)"; // As all utility functions contain an argument or more, this is hardcoded here.

+ 22 - 19
modules/gdscript/tests/scripts/completion/common/identifiers_in_call.cfg

@@ -1,25 +1,28 @@
 scene="res://completion/get_node/get_node.tscn"
 [output]
 include=[
-    ; Node
-    {"display": "add_child(…)"},
-    {"display": "owner"},
-    {"display": "child_entered_tree"},
+	; Utility Functions
+	{"display": "print(…)", "insert_text": "print("},
 
-    ; GDScript: class_a.notest.gd
-    {"display": "property_of_a"},
-    {"display": "func_of_a()"},
-    {"display": "signal_of_a"},
+	; Node
+	{"display": "add_child(…)"},
+	{"display": "owner"},
+	{"display": "child_entered_tree"},
 
-    ; GDScript: identifiers.gd
-    {"display": "test_signal_1"},
-    {"display": "test_signal_2"},
-    {"display": "test_var_1"},
-    {"display": "test_var_2"},
-    {"display": "test_func_1(…)"},
-    {"display": "test_func_2(…)"},
-    {"display": "test_parameter_1"},
-    {"display": "test_parameter_2"},
-    {"display": "local_test_var_1"},
-    {"display": "local_test_var_2"},
+	; GDScript: class_a.notest.gd
+	{"display": "property_of_a"},
+	{"display": "func_of_a()"},
+	{"display": "signal_of_a"},
+
+	; GDScript: identifiers.gd
+	{"display": "test_signal_1"},
+	{"display": "test_signal_2"},
+	{"display": "test_var_1"},
+	{"display": "test_var_2"},
+	{"display": "test_func_1(…)"},
+	{"display": "test_func_2(…)"},
+	{"display": "test_parameter_1"},
+	{"display": "test_parameter_2"},
+	{"display": "local_test_var_1"},
+	{"display": "local_test_var_2"},
 ]

+ 22 - 19
modules/gdscript/tests/scripts/completion/common/identifiers_in_function_body.cfg

@@ -1,25 +1,28 @@
 scene="res://completion/get_node/get_node.tscn"
 [output]
 include=[
-    ; Node
-    {"display": "add_child(…)"},
-    {"display": "owner"},
-    {"display": "child_entered_tree"},
+	; Utility Functions
+	{"display": "print(…)", "insert_text": "print("},
 
-    ; GDScript: class_a.notest.gd
-    {"display": "property_of_a"},
-    {"display": "func_of_a()"},
-    {"display": "signal_of_a"},
+	; Node
+	{"display": "add_child(…)"},
+	{"display": "owner"},
+	{"display": "child_entered_tree"},
 
-    ; GDScript: identifiers.gd
-    {"display": "test_signal_1"},
-    {"display": "test_signal_2"},
-    {"display": "test_var_1"},
-    {"display": "test_var_2"},
-    {"display": "test_func_1(…)"},
-    {"display": "test_func_2(…)"},
-    {"display": "test_parameter_1"},
-    {"display": "test_parameter_2"},
-    {"display": "local_test_var_1"},
-    {"display": "local_test_var_2"},
+	; GDScript: class_a.notest.gd
+	{"display": "property_of_a"},
+	{"display": "func_of_a()"},
+	{"display": "signal_of_a"},
+
+	; GDScript: identifiers.gd
+	{"display": "test_signal_1"},
+	{"display": "test_signal_2"},
+	{"display": "test_var_1"},
+	{"display": "test_var_2"},
+	{"display": "test_func_1(…)"},
+	{"display": "test_func_2(…)"},
+	{"display": "test_parameter_1"},
+	{"display": "test_parameter_2"},
+	{"display": "local_test_var_1"},
+	{"display": "local_test_var_2"},
 ]

+ 22 - 19
modules/gdscript/tests/scripts/completion/common/identifiers_in_unclosed_call.cfg

@@ -1,25 +1,28 @@
 scene="res://completion/get_node/get_node.tscn"
 [output]
 include=[
-    ; Node
-    {"display": "add_child(…)"},
-    {"display": "owner"},
-    {"display": "child_entered_tree"},
+	; Utility Functions
+	{"display": "print(…)", "insert_text": "print("},
 
-    ; GDScript: class_a.notest.gd
-    {"display": "property_of_a"},
-    {"display": "func_of_a()"},
-    {"display": "signal_of_a"},
+	; Node
+	{"display": "add_child(…)"},
+	{"display": "owner"},
+	{"display": "child_entered_tree"},
 
-    ; GDScript: identifiers.gd
-    {"display": "test_signal_1"},
-    {"display": "test_signal_2"},
-    {"display": "test_var_1"},
-    {"display": "test_var_2"},
-    {"display": "test_func_1(…)"},
-    {"display": "test_func_2(…)"},
-    {"display": "test_parameter_1"},
-    {"display": "test_parameter_2"},
-    {"display": "local_test_var_1"},
-    {"display": "local_test_var_2"},
+	; GDScript: class_a.notest.gd
+	{"display": "property_of_a"},
+	{"display": "func_of_a()"},
+	{"display": "signal_of_a"},
+
+	; GDScript: identifiers.gd
+	{"display": "test_signal_1"},
+	{"display": "test_signal_2"},
+	{"display": "test_var_1"},
+	{"display": "test_var_2"},
+	{"display": "test_func_1(…)"},
+	{"display": "test_func_2(…)"},
+	{"display": "test_parameter_1"},
+	{"display": "test_parameter_2"},
+	{"display": "local_test_var_1"},
+	{"display": "local_test_var_2"},
 ]