Make Script Editor's parser execute sooner if errors are known to exist

This commit is contained in:
Micky 2024-01-24 19:13:06 +01:00
parent 893bbdfde8
commit 02cc1879fd
4 changed files with 16 additions and 3 deletions

View file

@ -1119,7 +1119,12 @@ void CodeTextEditor::update_editor_settings() {
text_editor->set_code_hint_draw_below(EDITOR_GET("text_editor/completion/put_callhint_tooltip_below_current_line"));
code_complete_enabled = EDITOR_GET("text_editor/completion/code_complete_enabled");
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"));
bool first_time = idle_time == 0.0;
idle_time = EDITOR_GET("text_editor/completion/idle_parse_delay");
idle_time_with_errors = EDITOR_GET("text_editor/completion/idle_parse_delay_with_errors_found");
if (first_time) {
idle->set_wait_time(idle_time);
}
// Appearance: Guidelines
if (EDITOR_GET("text_editor/appearance/guidelines/show_line_length_guidelines")) {
@ -1624,8 +1629,11 @@ void CodeTextEditor::_notification(int p_what) {
void CodeTextEditor::set_error_count(int p_error_count) {
error_button->set_text(itos(p_error_count));
error_button->set_visible(p_error_count > 0);
if (!p_error_count) {
if (p_error_count > 0) {
_set_show_errors_panel(false);
idle->set_wait_time(idle_time_with_errors); // Parsing should happen sooner.
} else {
idle->set_wait_time(idle_time);
}
}
@ -1797,7 +1805,6 @@ CodeTextEditor::CodeTextEditor() {
add_child(status_bar);
status_bar->set_h_size_flags(SIZE_EXPAND_FILL);
status_bar->set_custom_minimum_size(Size2(0, 24 * EDSCALE)); // Adjust for the height of the warning icon.
idle = memnew(Timer);
add_child(idle);
idle->set_one_shot(true);