diff options
author | Itamar <itamar8910@gmail.com> | 2022-02-12 11:20:25 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-12 11:24:32 +0100 |
commit | 8bb4d466761f5d71202652dbbfb6ef0e22cd0a05 (patch) | |
tree | 80f7c4de6a5a92cd84c300436c86f9e9fdb3eed2 /Userland | |
parent | a456759d7ab126ce21f9eec757432c26abfcf86d (diff) | |
download | serenity-8bb4d466761f5d71202652dbbfb6ef0e22cd0a05.zip |
HackStudio: Only query token information if semantic highlighting is on
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/DevTools/HackStudio/Editor.cpp | 2 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/HackStudio.h | 1 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/HackStudioWidget.cpp | 9 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/HackStudioWidget.h | 2 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/main.cpp | 5 |
5 files changed, 18 insertions, 1 deletions
diff --git a/Userland/DevTools/HackStudio/Editor.cpp b/Userland/DevTools/HackStudio/Editor.cpp index f077e7e583..f0472977e3 100644 --- a/Userland/DevTools/HackStudio/Editor.cpp +++ b/Userland/DevTools/HackStudio/Editor.cpp @@ -733,6 +733,8 @@ void Editor::set_debug_mode(bool enabled) void Editor::on_token_info_timer_tick() { + if (!semantic_syntax_highlighting_is_enabled()) + return; if (!m_language_client || !m_language_client->is_active_client()) return; diff --git a/Userland/DevTools/HackStudio/HackStudio.h b/Userland/DevTools/HackStudio/HackStudio.h index 962c9d3b69..16392de9f8 100644 --- a/Userland/DevTools/HackStudio/HackStudio.h +++ b/Userland/DevTools/HackStudio/HackStudio.h @@ -22,6 +22,7 @@ Project& project(); String currently_open_file(); void set_current_editor_wrapper(RefPtr<EditorWrapper>); void for_each_open_file(Function<void(ProjectFile const&)>); +bool semantic_syntax_highlighting_is_enabled(); class Locator; Locator& locator(); diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index de9cc2a485..336010d987 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -1166,7 +1166,9 @@ void HackStudioWidget::create_project_menu(GUI::Window& window) new_submenu.add_action(*m_new_plain_file_action); new_submenu.add_separator(); new_submenu.add_action(*m_new_directory_action); - project_menu.add_action(create_toggle_syntax_highlighting_mode_action()); + + m_toggle_semantic_highlighting_action = create_toggle_syntax_highlighting_mode_action(); + project_menu.add_action(*m_toggle_semantic_highlighting_action); } void HackStudioWidget::create_edit_menu(GUI::Window& window) @@ -1536,4 +1538,9 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_toggle_syntax_highlighting_m return action; } +bool HackStudioWidget::semantic_syntax_highlighting_is_enabled() const +{ + return m_toggle_semantic_highlighting_action->is_checked(); +} + } diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.h b/Userland/DevTools/HackStudio/HackStudioWidget.h index 07929f4d87..0c2550f1db 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.h +++ b/Userland/DevTools/HackStudio/HackStudioWidget.h @@ -71,6 +71,7 @@ public: void open_coredump(String const& coredump_path); void for_each_open_file(Function<void(ProjectFile const&)>); + bool semantic_syntax_highlighting_is_enabled() const; private: static String get_full_path_of_serenity_source(const String& file); @@ -217,6 +218,7 @@ private: RefPtr<GUI::Action> m_run_action; RefPtr<GUI::Action> m_locations_history_back_action; RefPtr<GUI::Action> m_locations_history_forward_action; + RefPtr<GUI::Action> m_toggle_semantic_highlighting_action; RefPtr<Gfx::Font> read_editor_font_from_config(); void change_editor_font(RefPtr<Gfx::Font>); diff --git a/Userland/DevTools/HackStudio/main.cpp b/Userland/DevTools/HackStudio/main.cpp index 7f32222f1e..d2c71ba06d 100644 --- a/Userland/DevTools/HackStudio/main.cpp +++ b/Userland/DevTools/HackStudio/main.cpp @@ -173,4 +173,9 @@ void for_each_open_file(Function<void(ProjectFile const&)> func) s_hack_studio_widget->for_each_open_file(move(func)); } +bool semantic_syntax_highlighting_is_enabled() +{ + return s_hack_studio_widget->semantic_syntax_highlighting_is_enabled(); +} + } |