Skip to content
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

Remove redundant keywords from TextEdit #49742

Merged
merged 1 commit into from
Jun 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions editor/plugins/script_text_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,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 @@ -222,47 +221,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_warnings_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