summaryrefslogtreecommitdiff
path: root/editor/code_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r--editor/code_editor.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 03695419cb..eeb99b3677 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -31,6 +31,7 @@
#include "code_editor.h"
#include "core/input/input.h"
+#include "core/object/message_queue.h"
#include "core/os/keyboard.h"
#include "core/string/string_builder.h"
#include "editor/editor_scale.h"
@@ -950,14 +951,20 @@ void CodeTextEditor::update_editor_settings() {
text_editor->set_line_folding_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/code_folding"));
text_editor->set_draw_fold_gutter(EditorSettings::get_singleton()->get("text_editor/appearance/code_folding"));
text_editor->set_wrap_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/word_wrap"));
- text_editor->set_show_line_length_guidelines(EditorSettings::get_singleton()->get("text_editor/appearance/show_line_length_guidelines"));
- text_editor->set_line_length_guideline_soft_column(EditorSettings::get_singleton()->get("text_editor/appearance/line_length_guideline_soft_column"));
- text_editor->set_line_length_guideline_hard_column(EditorSettings::get_singleton()->get("text_editor/appearance/line_length_guideline_hard_column"));
text_editor->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/cursor/scroll_past_end_of_file"));
text_editor->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/cursor/block_caret"));
text_editor->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink"));
text_editor->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/cursor/caret_blink_speed"));
- text_editor->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/completion/auto_brace_complete"));
+ text_editor->set_auto_brace_completion_enabled(EditorSettings::get_singleton()->get("text_editor/completion/auto_brace_complete"));
+
+ if (EditorSettings::get_singleton()->get("text_editor/appearance/show_line_length_guidelines")) {
+ TypedArray<int> guideline_cols;
+ guideline_cols.append(EditorSettings::get_singleton()->get("text_editor/appearance/line_length_guideline_hard_column"));
+ if (EditorSettings::get_singleton()->get("text_editor/appearance/line_length_guideline_soft_column") != guideline_cols[0]) {
+ guideline_cols.append(EditorSettings::get_singleton()->get("text_editor/appearance/line_length_guideline_soft_column"));
+ }
+ text_editor->set_line_length_guidelines(guideline_cols);
+ }
}
void CodeTextEditor::set_find_replace_bar(FindReplaceBar *p_bar) {
@@ -1567,6 +1574,17 @@ void CodeTextEditor::_update_font() {
}
void CodeTextEditor::_on_settings_change() {
+ if (settings_changed) {
+ return;
+ }
+
+ settings_changed = true;
+ MessageQueue::get_singleton()->push_callable(callable_mp(this, &CodeTextEditor::_apply_settings_change));
+}
+
+void CodeTextEditor::_apply_settings_change() {
+ settings_changed = false;
+
_update_text_editor_theme();
_update_font();
@@ -1597,16 +1615,9 @@ void CodeTextEditor::_on_settings_change() {
} break;
}
- // Auto brace completion.
- text_editor->set_auto_brace_completion(
- EDITOR_GET("text_editor/completion/auto_brace_complete"));
-
- code_complete_timer->set_wait_time(
- EDITOR_GET("text_editor/completion/code_complete_delay"));
-
- // Call hint settings.
text_editor->set_code_hint_draw_below(EDITOR_GET("text_editor/completion/put_callhint_tooltip_below_current_line"));
+ code_complete_timer->set_wait_time(EDITOR_GET("text_editor/completion/code_complete_delay"));
idle->set_wait_time(EDITOR_GET("text_editor/completion/idle_parse_delay"));
}
@@ -1820,7 +1831,7 @@ CodeTextEditor::CodeTextEditor() {
}
text_editor->set_draw_line_numbers(true);
- text_editor->set_brace_matching(true);
+ text_editor->set_highlight_matching_braces_enabled(true);
text_editor->set_auto_indent_enabled(true);
status_bar = memnew(HBoxContainer);