1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:17:44 +00:00

HackStudio: Only query token information if semantic highlighting is on

This commit is contained in:
Itamar 2022-02-12 11:20:25 +02:00 committed by Andreas Kling
parent a456759d7a
commit 8bb4d46676
5 changed files with 18 additions and 1 deletions

View file

@ -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;

View file

@ -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();

View file

@ -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();
}
}

View file

@ -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>);

View file

@ -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();
}
}