mirror of
https://github.com/godotengine/godot.git
synced 2025-04-13 01:00:35 +08:00
Make Script Editor's parser execute sooner if errors are known to exist
This commit is contained in:
parent
893bbdfde8
commit
02cc1879fd
@ -1292,6 +1292,9 @@
|
||||
<member name="text_editor/completion/idle_parse_delay" type="float" setter="" getter="">
|
||||
The delay in seconds after which the script editor should check for errors when the user stops typing.
|
||||
</member>
|
||||
<member name="text_editor/completion/idle_parse_delay_with_errors_found" type="float" setter="" getter="">
|
||||
The delay used instead of [member text_editor/completion/idle_parse_delay], when the parser has found errors. A lower value should feel more responsive while fixing code, but may cause notable stuttering and increase CPU usage.
|
||||
</member>
|
||||
<member name="text_editor/completion/put_callhint_tooltip_below_current_line" type="bool" setter="" getter="">
|
||||
If [code]true[/code], the code completion tooltip will appear below the current line unless there is no space on screen below the current line. If [code]false[/code], the code completion tooltip will appear above the current line.
|
||||
</member>
|
||||
|
@ -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);
|
||||
|
@ -174,6 +174,8 @@ class CodeTextEditor : public VBoxContainer {
|
||||
|
||||
Label *info = nullptr;
|
||||
Timer *idle = nullptr;
|
||||
float idle_time = 0.0f;
|
||||
float idle_time_with_errors = 0.0f;
|
||||
bool code_complete_enabled = true;
|
||||
Timer *code_complete_timer = nullptr;
|
||||
int code_complete_timer_line = 0;
|
||||
|
@ -724,6 +724,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
||||
|
||||
// Completion
|
||||
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "text_editor/completion/idle_parse_delay", 1.5, "0.1,10,0.01")
|
||||
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "text_editor/completion/idle_parse_delay_with_errors_found", 0.5, "0.1,5,0.01")
|
||||
_initial_set("text_editor/completion/auto_brace_complete", true, true);
|
||||
_initial_set("text_editor/completion/code_complete_enabled", true, true);
|
||||
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "text_editor/completion/code_complete_delay", 0.3, "0.01,5,0.01,or_greater")
|
||||
|
Loading…
x
Reference in New Issue
Block a user