mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
HackStudio: Allow toggling between simple and semantic highlighting
Until it becomes enough stable and performant, semantic highlighting is disabled by default. It can be toggled on via the "Project" menu in HackStudio.
This commit is contained in:
parent
81dcf6c58b
commit
8ec4328fcb
4 changed files with 33 additions and 8 deletions
|
@ -1158,9 +1158,11 @@ void HackStudioWidget::create_project_menu(GUI::Window& window)
|
|||
for (auto& new_file_action : m_new_file_actions) {
|
||||
new_submenu.add_action(new_file_action);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
void HackStudioWidget::create_edit_menu(GUI::Window& window)
|
||||
|
@ -1520,4 +1522,14 @@ void HackStudioWidget::for_each_open_file(Function<void(ProjectFile const&)> fun
|
|||
}
|
||||
}
|
||||
|
||||
NonnullRefPtr<GUI::Action> HackStudioWidget::create_toggle_syntax_highlighting_mode_action()
|
||||
{
|
||||
auto action = GUI::Action::create_checkable("&Semantic Highlighting", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-cplusplus.png").release_value_but_fixme_should_propagate_errors(), [this](auto& action) {
|
||||
for (auto& editor_wrapper : m_all_editor_wrappers)
|
||||
editor_wrapper.editor().set_semantic_syntax_highlighting(action.is_checked());
|
||||
});
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue