mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
HackStudio: Enable CMake syntax highlighting
This commit is contained in:
parent
ac824677b8
commit
0d0ad22572
Notes:
sideshowbarker
2024-07-17 09:49:33 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/0d0ad22572 Pull-request: https://github.com/SerenityOS/serenity/pull/17668 Reviewed-by: https://github.com/ADKaster ✅
4 changed files with 10 additions and 2 deletions
|
@ -55,5 +55,5 @@ set(GENERATED_SOURCES
|
|||
)
|
||||
|
||||
serenity_app(HackStudio ICON app-hack-studio)
|
||||
target_link_libraries(HackStudio PRIVATE LibWebView LibWeb LibMarkdown LibGUI LibCpp LibGfx LibCore LibVT LibDebug LibX86 LibDiff LibShell LibSymbolication LibSyntax LibRegex LibSQL LibConfig LibCore LibCoredump LibDesktop LibIPC LibJS LibMain LibThreading)
|
||||
target_link_libraries(HackStudio PRIVATE LibWebView LibWeb LibMarkdown LibGUI LibCpp LibCMake LibGfx LibCore LibVT LibDebug LibX86 LibDiff LibShell LibSymbolication LibSyntax LibRegex LibSQL LibConfig LibCore LibCoredump LibDesktop LibIPC LibJS LibMain LibThreading)
|
||||
add_dependencies(HackStudio CppLanguageServer)
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <AK/Debug.h>
|
||||
#include <AK/JsonParser.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <LibCMake/SyntaxHighlighter.h>
|
||||
#include <LibConfig/Client.h>
|
||||
#include <LibCore/DeprecatedFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
|
@ -636,6 +637,9 @@ void Editor::set_syntax_highlighter_for(CodeDocument const& document)
|
|||
} else
|
||||
set_syntax_highlighter(make<Cpp::SyntaxHighlighter>());
|
||||
|
||||
break;
|
||||
case Language::CMake:
|
||||
set_syntax_highlighter(make<CMake::SyntaxHighlighter>());
|
||||
break;
|
||||
case Language::CSS:
|
||||
set_syntax_highlighter(make<Web::CSS::SyntaxHighlighter>());
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
#include "Language.h"
|
||||
#include <AK/LexicalPath.h>
|
||||
|
||||
namespace HackStudio {
|
||||
|
||||
|
@ -19,6 +18,8 @@ Language language_from_file(LexicalPath const& file)
|
|||
if (extension == "c" || extension == "cc" || extension == "cxx" || extension == "cpp" || extension == "c++"
|
||||
|| extension == "h" || extension == "hh" || extension == "hxx" || extension == "hpp" || extension == "h++")
|
||||
return Language::Cpp;
|
||||
if (extension == "cmake" || (extension == "txt" && file.title() == "CMakeLists"))
|
||||
return Language::CMake;
|
||||
if (extension == "js" || extension == "mjs" || extension == "json")
|
||||
return Language::JavaScript;
|
||||
if (extension == "html" || extension == "htm")
|
||||
|
@ -61,6 +62,8 @@ DeprecatedString language_name_from_file(LexicalPath const& file)
|
|||
if (extension == "c" || extension == "cc" || extension == "cxx" || extension == "cpp" || extension == "c++"
|
||||
|| extension == "h" || extension == "hh" || extension == "hxx" || extension == "hpp" || extension == "h++")
|
||||
return "C++";
|
||||
if (extension == "cmake" || (extension == "txt" && file.title() == "CMakeLists"))
|
||||
return "CMake";
|
||||
if (extension == "js" || extension == "mjs" || extension == "json")
|
||||
return "JavaScript";
|
||||
if (extension == "gml")
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
namespace HackStudio {
|
||||
enum class Language {
|
||||
Unknown,
|
||||
CMake,
|
||||
Cpp,
|
||||
CSS,
|
||||
JavaScript,
|
||||
|
|
Loading…
Reference in a new issue