summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-08 22:44:19 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-08 22:44:19 +0100
commitdbd3d8a1f8cc492e9cc77933965676de794f129f (patch)
treea46e28cfb7f4240d57b1d751fcd5ae95c30eaadb
parenteff2739cf7b80e0b6c4c48ae10250044c63e10ae (diff)
parentd5e1b4a85760773758507501a4aa7c3b89f9cfdc (diff)
Merge pull request #71047 from jordigcs/node-path-apost
Force double quotes for NodePaths with apostrophes
-rw-r--r--modules/gdscript/gdscript_editor.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 6f8b90bd06..dcf17b9fe7 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -2977,7 +2977,9 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c
// The path needs quotes if it's not a valid identifier (with an exception
// for "/" as path separator, which also doesn't require quotes).
if (!opt.replace("/", "_").is_valid_identifier()) {
- opt = opt.quote(quote_style); // Handle user preference.
+ // Ignore quote_style and just use double quotes for paths with apostrophes.
+ // Double quotes don't need to be checked because they're not valid in node and property names.
+ opt = opt.quote(opt.contains("'") ? "\"" : quote_style); // Handle user preference.
}
ScriptLanguage::CodeCompletionOption option(opt, ScriptLanguage::CODE_COMPLETION_KIND_NODE_PATH);
options.insert(option.display, option);