-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Style: Cleanup code using text_editor/completion/use_single_quotes
#51642
Merged
akien-mga
merged 1 commit into
godotengine:master
from
akien-mga:cleanup-use_single_quotes
Aug 13, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -623,11 +623,11 @@ static String _make_arguments_hint(const GDScriptParser::FunctionNode *p_functio | |
} | ||
|
||
static void _get_directory_contents(EditorFileSystemDirectory *p_dir, Map<String, ScriptCodeCompletionOption> &r_list) { | ||
const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", false) ? "'" : "\""; | ||
const String quote_style = EDITOR_GET("text_editor/completion/use_single_quotes") ? "'" : "\""; | ||
|
||
for (int i = 0; i < p_dir->get_file_count(); i++) { | ||
ScriptCodeCompletionOption option(p_dir->get_file_path(i), ScriptCodeCompletionOption::KIND_FILE_PATH); | ||
option.insert_text = quote_style + option.display + quote_style; | ||
option.insert_text = option.display.quote(quote_style); | ||
r_list.insert(option.display, option); | ||
} | ||
|
||
|
@@ -641,20 +641,20 @@ static void _find_annotation_arguments(const GDScriptParser::AnnotationNode *p_a | |
if (p_argument == 3 || p_argument == 4) { | ||
// Slider hint. | ||
ScriptCodeCompletionOption slider1("or_greater", ScriptCodeCompletionOption::KIND_PLAIN_TEXT); | ||
slider1.insert_text = p_quote_style + slider1.display + p_quote_style; | ||
slider1.insert_text = slider1.display.quote(p_quote_style); | ||
r_result.insert(slider1.display, slider1); | ||
ScriptCodeCompletionOption slider2("or_lesser", ScriptCodeCompletionOption::KIND_PLAIN_TEXT); | ||
slider2.insert_text = p_quote_style + slider2.display + p_quote_style; | ||
slider2.insert_text = slider2.display.quote(p_quote_style); | ||
r_result.insert(slider2.display, slider2); | ||
} | ||
} else if (p_annotation->name == "@export_exp_easing") { | ||
if (p_argument == 0 || p_argument == 1) { | ||
// Easing hint. | ||
ScriptCodeCompletionOption hint1("attenuation", ScriptCodeCompletionOption::KIND_PLAIN_TEXT); | ||
hint1.insert_text = p_quote_style + hint1.display + p_quote_style; | ||
hint1.insert_text = hint1.display.quote(p_quote_style); | ||
r_result.insert(hint1.display, hint1); | ||
ScriptCodeCompletionOption hint2("inout", ScriptCodeCompletionOption::KIND_PLAIN_TEXT); | ||
hint2.insert_text = p_quote_style + hint2.display + p_quote_style; | ||
hint2.insert_text = hint2.display.quote(p_quote_style); | ||
r_result.insert(hint2.display, hint2); | ||
} | ||
} else if (p_annotation->name == "@export_node_path") { | ||
|
@@ -2192,7 +2192,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c | |
Variant base = p_base.value; | ||
GDScriptParser::DataType base_type = p_base.type; | ||
|
||
const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", false) ? "'" : "\""; | ||
const String quote_style = EDITOR_GET("text_editor/completion/use_single_quotes") ? "'" : "\""; | ||
|
||
while (base_type.is_set() && !base_type.is_variant()) { | ||
switch (base_type.kind) { | ||
|
@@ -2254,7 +2254,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c | |
} | ||
String name = s.get_slice("/", 1); | ||
ScriptCodeCompletionOption option("/root/" + name, ScriptCodeCompletionOption::KIND_NODE_PATH); | ||
option.insert_text = quote_style + option.display + quote_style; | ||
option.insert_text = option.display.quote(quote_style); | ||
r_result.insert(option.display, option); | ||
} | ||
} | ||
|
@@ -2270,7 +2270,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c | |
} | ||
String name = s.get_slice("/", 1); | ||
ScriptCodeCompletionOption option(name, ScriptCodeCompletionOption::KIND_CONSTANT); | ||
option.insert_text = quote_style + option.display + quote_style; | ||
option.insert_text = option.display.quote(quote_style); | ||
r_result.insert(option.display, option); | ||
} | ||
} | ||
|
@@ -2305,8 +2305,6 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c | |
} | ||
|
||
static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, const GDScriptParser::Node *p_call, int p_argidx, Map<String, ScriptCodeCompletionOption> &r_result, bool &r_forced, String &r_arghint) { | ||
const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", false) ? "'" : "\""; | ||
|
||
if (p_call->type == GDScriptParser::Node::PRELOAD) { | ||
if (p_argidx == 0 && bool(EditorSettings::get_singleton()->get("text_editor/completion/complete_file_paths"))) { | ||
_get_directory_contents(EditorFileSystem::get_singleton()->get_filesystem(), r_result); | ||
|
@@ -2382,7 +2380,7 @@ static void _find_call_arguments(GDScriptParser::CompletionContext &p_context, c | |
} | ||
|
||
::Error GDScriptLanguage::complete_code(const String &p_code, const String &p_path, Object *p_owner, List<ScriptCodeCompletionOption> *r_options, bool &r_forced, String &r_call_hint) { | ||
const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", false) ? "'" : "\""; | ||
const String quote_style = EDITOR_GET("text_editor/completion/use_single_quotes") ? "'" : "\""; | ||
|
||
GDScriptParser parser; | ||
GDScriptAnalyzer analyzer(&parser); | ||
|
@@ -2671,8 +2669,8 @@ ::Error GDScriptLanguage::complete_code(const String &p_code, const String &p_pa | |
Map<StringName, ProjectSettings::AutoloadInfo> autoloads = ProjectSettings::get_singleton()->get_autoload_list(); | ||
|
||
for (Map<StringName, ProjectSettings::AutoloadInfo>::Element *E = autoloads.front(); E; E = E->next()) { | ||
String name = E->key(); | ||
ScriptCodeCompletionOption option(quote_style + "/root/" + name + quote_style, ScriptCodeCompletionOption::KIND_NODE_PATH); | ||
String path = "/root/" + E->key(); | ||
ScriptCodeCompletionOption option(path.quote(quote_style), ScriptCodeCompletionOption::KIND_NODE_PATH); | ||
Comment on lines
+2672
to
+2673
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactored a bit to be able to use |
||
options.insert(option.display, option); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't respecting the setting.