diff --git a/Userland/Applications/TextEditor/CMakeLists.txt b/Userland/Applications/TextEditor/CMakeLists.txt index 670ffadd1c..fafddc577e 100644 --- a/Userland/Applications/TextEditor/CMakeLists.txt +++ b/Userland/Applications/TextEditor/CMakeLists.txt @@ -18,4 +18,4 @@ set(GENERATED_SOURCES ) serenity_app(TextEditor ICON app-text-editor) -target_link_libraries(TextEditor PRIVATE LibCore LibWebView LibWeb LibMarkdown LibGfx LibGUI LibShell LibRegex LibDesktop LibCpp LibJS LibSQL LibSyntax LibFileSystemAccessClient LibConfig LibMain) +target_link_libraries(TextEditor PRIVATE LibCore LibWebView LibWeb LibMarkdown LibGfx LibGUI LibShell LibRegex LibDesktop LibCpp LibCMake LibJS LibSQL LibSyntax LibFileSystemAccessClient LibConfig LibMain) diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp index 5b5334a812..b5a37d05de 100644 --- a/Userland/Applications/TextEditor/MainWidget.cpp +++ b/Userland/Applications/TextEditor/MainWidget.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -615,6 +616,13 @@ void MainWidget::initialize_menubar(GUI::Window& window) syntax_actions.add_action(*m_cpp_highlight); syntax_menu.add_action(*m_cpp_highlight); + m_cmake_highlight = GUI::Action::create_checkable("C&Make", [&](auto&) { + m_editor->set_syntax_highlighter(make()); + m_editor->update(); + }); + syntax_actions.add_action(*m_cmake_highlight); + syntax_menu.add_action(*m_cmake_highlight); + m_js_highlight = GUI::Action::create_checkable("&JavaScript", [&](auto&) { m_editor->set_syntax_highlighter(make()); m_editor->update(); @@ -695,6 +703,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) m_syntax_statusbar_menu->add_action(*m_plain_text_highlight); m_syntax_statusbar_menu->add_action(*m_cpp_highlight); + m_syntax_statusbar_menu->add_action(*m_cmake_highlight); m_syntax_statusbar_menu->add_action(*m_css_highlight); m_syntax_statusbar_menu->add_action(*m_git_highlight); m_syntax_statusbar_menu->add_action(*m_gml_highlight); @@ -721,6 +730,8 @@ void MainWidget::set_path(StringView path) if (m_extension == "c" || m_extension == "cc" || m_extension == "cxx" || m_extension == "cpp" || m_extension == "c++" || m_extension == "h" || m_extension == "hh" || m_extension == "hxx" || m_extension == "hpp" || m_extension == "h++") { m_cpp_highlight->activate(); + } else if (m_extension == "cmake" || (m_extension == "txt" && m_name == "CMakeLists")) { + m_cmake_highlight->activate(); } else if (m_extension == "js" || m_extension == "mjs" || m_extension == "json") { m_js_highlight->activate(); } else if (m_name == "COMMIT_EDITMSG") { diff --git a/Userland/Applications/TextEditor/MainWidget.h b/Userland/Applications/TextEditor/MainWidget.h index 61c37fefe6..e7782cad19 100644 --- a/Userland/Applications/TextEditor/MainWidget.h +++ b/Userland/Applications/TextEditor/MainWidget.h @@ -127,6 +127,7 @@ private: GUI::ActionGroup syntax_actions; RefPtr m_plain_text_highlight; + RefPtr m_cmake_highlight; RefPtr m_cpp_highlight; RefPtr m_css_highlight; RefPtr m_js_highlight;