Merge pull request #24437 from mateusfccp/single_quotes_option

Add settings for single-quotes on completion
This commit is contained in:
Rémi Verschelde 2019-04-30 14:58:33 +02:00 committed by GitHub
commit 9dc9434b1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 67 additions and 17 deletions

View file

@ -39,6 +39,10 @@
#include "scene/scene_string_names.h"
#include "viewport.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_settings.h"
#endif
VARIANT_ENUM_CAST(Node::PauseMode);
int Node::orphan_node_count = 0;
@ -2637,10 +2641,16 @@ NodePath Node::get_import_path() const {
static void _add_nodes_to_options(const Node *p_base, const Node *p_node, List<String> *r_options) {
#ifdef TOOLS_ENABLED
const String quote_style = EDITOR_DEF("text_editor/completion/use_single_quotes", 0) ? "'" : "\"";
#else
const String quote_style = "\"";
#endif
if (p_node != p_base && !p_node->get_owner())
return;
String n = p_base->get_path_to(p_node);
r_options->push_back("\"" + n + "\"");
r_options->push_back(quote_style + n + quote_style);
for (int i = 0; i < p_node->get_child_count(); i++) {
_add_nodes_to_options(p_base, p_node->get_child(i), r_options);
}