1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:18:12 +00:00

HackStudio: Integate with C++ parser-based autocomplete

By default, C++ auto completion will still be performed by the
lexer-based logic.
However, the parser-based logic can be switched on via the menubar.
This commit is contained in:
Itamar 2021-01-23 16:55:19 +02:00 committed by Andreas Kling
parent 8ed96eb27c
commit fa18010477
14 changed files with 70 additions and 11 deletions

View file

@ -841,6 +841,7 @@ void HackStudioWidget::create_project_menubar(GUI::MenuBar& menubar)
{
auto& project_menu = menubar.add_menu("Project");
project_menu.add_action(*m_new_action);
project_menu.add_action(*create_set_autocomplete_mode_action());
}
void HackStudioWidget::create_edit_menubar(GUI::MenuBar& menubar)
@ -919,6 +920,14 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_stop_action()
return action;
}
NonnullRefPtr<GUI::Action> HackStudioWidget::create_set_autocomplete_mode_action()
{
auto action = GUI::Action::create_checkable("AutoComplete C++ with Parser", [this](auto& action) {
get_language_client<LanguageClients::Cpp::ServerConnection>(project().root_path())->set_autocomplete_mode(action.is_checked() ? "Parser" : "Lexer");
});
return action;
}
void HackStudioWidget::initialize_menubar(GUI::MenuBar& menubar)
{
create_app_menubar(menubar);