GDScript completion: Handle quote style ad-hoc to remove editor dependency

`core` and `scene` shouldn't depend on `editor`, so they can't query this style
setting in `get_argument_options`. But we can handle it after the fact in
GDScript's completion code.

Also cleans up a couple extra unused invalid includes in `core`.
This commit is contained in:
Rémi Verschelde
2021-10-01 17:06:48 +02:00
parent 865b62b1cd
commit b85dfd990e
8 changed files with 22 additions and 62 deletions

View File

@@ -32,11 +32,6 @@
#include "core/config/engine.h"
#include "core/version.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_settings.h"
#endif
#include "scene/main/scene_tree.h"
#include "scene/scene_string_names.h"
@@ -268,19 +263,13 @@ void ShaderMaterial::_bind_methods() {
}
void ShaderMaterial::get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const {
#ifdef TOOLS_ENABLED
const String quote_style = EDITOR_GET("text_editor/completion/use_single_quotes") ? "'" : "\"";
#else
const String quote_style = "\"";
#endif
String f = p_function.operator String();
if ((f == "get_shader_param" || f == "set_shader_param") && p_idx == 0) {
if (shader.is_valid()) {
List<PropertyInfo> pl;
shader->get_param_list(&pl);
for (const PropertyInfo &E : pl) {
r_options->push_back(E.name.replace_first("shader_param/", "").quote(quote_style));
r_options->push_back(E.name.replace_first("shader_param/", "").quote());
}
}
}