summaryrefslogtreecommitdiffstats
path: root/editor/plugins/script_text_editor.cpp
diff options
context:
space:
mode:
authorPaulb23 <p_batty@hotmail.co.uk>2020-09-10 21:25:40 +0100
committerPaulb23 <p_batty@hotmail.co.uk>2021-06-01 15:38:45 +0100
commit680dc9e81a79761f733db5ce7f3fa0c05b8e1ff6 (patch)
tree7a588e2744f4ce5cf7e821742714779102e7bfca /editor/plugins/script_text_editor.cpp
parentc9ce5367e3d35074193eb3999d9e2f9cbb8576c6 (diff)
downloadredot-engine-680dc9e81a79761f733db5ce7f3fa0c05b8e1ff6.tar.gz
Add comment and string tracking to CodeEdit
Diffstat (limited to 'editor/plugins/script_text_editor.cpp')
-rw-r--r--editor/plugins/script_text_editor.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index fe5d830239..99278a18ba 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -203,6 +203,26 @@ void ScriptTextEditor::_set_theme_for_script() {
CodeEdit *text_edit = code_editor->get_text_editor();
text_edit->get_syntax_highlighter()->update_cache();
+ List<String> strings;
+ script->get_language()->get_string_delimiters(&strings);
+ text_edit->clear_string_delimiters();
+ for (List<String>::Element *E = strings.front(); E; E = E->next()) {
+ String string = E->get();
+ String beg = string.get_slice(" ", 0);
+ String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String();
+ text_edit->add_string_delimiter(beg, end, end == "");
+ }
+
+ List<String> comments;
+ script->get_language()->get_comment_delimiters(&comments);
+ text_edit->clear_comment_delimiters();
+ for (List<String>::Element *E = comments.front(); E; E = E->next()) {
+ String comment = E->get();
+ String beg = comment.get_slice(" ", 0);
+ 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();