Skip to content

Commit

Permalink
Merge pull request #49742 from Paulb23/remove_keywords_textedit
Browse files Browse the repository at this point in the history
Remove redundant keywords from TextEdit
  • Loading branch information
akien-mga committed Jun 19, 2021
2 parents 9b7c963 + ab49ea0 commit 60dcc4f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 53 deletions.
42 changes: 0 additions & 42 deletions editor/plugins/script_text_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ void ScriptTextEditor::enable_editor() {

void ScriptTextEditor::_load_theme_settings() {
CodeEdit *text_edit = code_editor->get_text_editor();
text_edit->clear_keywords();

Color updated_marked_line_color = EDITOR_GET("text_editor/highlighting/mark_color");
Color updated_safe_line_number_color = EDITOR_GET("text_editor/highlighting/safe_line_number_color");
Expand Down Expand Up @@ -220,47 +219,6 @@ void ScriptTextEditor::_set_theme_for_script() {
String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String();
text_edit->add_comment_delimiter(beg, end, end == "");
}

/* add keywords for auto completion */
// singleton autoloads (as types, just as engine singletons are)
Map<StringName, ProjectSettings::AutoloadInfo> autoloads = ProjectSettings::get_singleton()->get_autoload_list();
for (Map<StringName, ProjectSettings::AutoloadInfo>::Element *E = autoloads.front(); E; E = E->next()) {
const ProjectSettings::AutoloadInfo &info = E->value();
if (info.is_singleton) {
text_edit->add_keyword(info.name);
}
}

// engine types
List<StringName> types;
ClassDB::get_class_list(&types);
for (List<StringName>::Element *E = types.front(); E; E = E->next()) {
String n = E->get();
if (n.begins_with("_")) {
n = n.substr(1, n.length());
}
text_edit->add_keyword(n);
}

// user types
List<StringName> global_classes;
ScriptServer::get_global_class_list(&global_classes);
for (List<StringName>::Element *E = global_classes.front(); E; E = E->next()) {
text_edit->add_keyword(E->get());
}

List<String> keywords;
script->get_language()->get_reserved_words(&keywords);
for (List<String>::Element *E = keywords.front(); E; E = E->next()) {
text_edit->add_keyword(E->get());
}

// core types
List<String> core_types;
script->get_language()->get_core_type_words(&core_types);
for (List<String>::Element *E = core_types.front(); E; E = E->next()) {
text_edit->add_keyword(E->get());
}
}

void ScriptTextEditor::_show_errors_panel(bool p_show) {
Expand Down
8 changes: 0 additions & 8 deletions scene/gui/text_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4625,14 +4625,6 @@ Color TextEdit::get_line_background_color(int p_line) {
return text.get_line_background_color(p_line);
}

void TextEdit::add_keyword(const String &p_keyword) {
keywords.insert(p_keyword);
}

void TextEdit::clear_keywords() {
keywords.clear();
}

void TextEdit::set_auto_indent(bool p_auto_indent) {
auto_indent = p_auto_indent;
}
Expand Down
3 changes: 0 additions & 3 deletions scene/gui/text_edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,6 @@ class TextEdit : public Control {
void set_insert_mode(bool p_enabled);
bool is_insert_mode() const;

void add_keyword(const String &p_keyword);
void clear_keywords();

double get_v_scroll() const;
void set_v_scroll(double p_scroll);

Expand Down

0 comments on commit 60dcc4f

Please sign in to comment.