Add settings for single-quotes on completion

This commit is contained in:
Mateus Felipe C. C. Pinto 2018-12-17 23:53:54 -02:00
parent 0cff752be1
commit ca1935d6f7
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);
void Node::_notification(int p_notification) {
@ -2600,10 +2604,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);
}