From b1ce852c373119e59442897d03cf33131f656cec Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Tue, 7 Mar 2023 20:52:07 +0000 Subject: [PATCH] HackStudio: Enable CMakeCache.txt highlighting --- Userland/DevTools/HackStudio/Editor.cpp | 4 ++++ Userland/DevTools/HackStudio/Language.cpp | 4 ++++ Userland/DevTools/HackStudio/Language.h | 1 + 3 files changed, 9 insertions(+) diff --git a/Userland/DevTools/HackStudio/Editor.cpp b/Userland/DevTools/HackStudio/Editor.cpp index 4395f3ff5a0..af2f5b351b4 100644 --- a/Userland/DevTools/HackStudio/Editor.cpp +++ b/Userland/DevTools/HackStudio/Editor.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -641,6 +642,9 @@ void Editor::set_syntax_highlighter_for(CodeDocument const& document) case Language::CMake: set_syntax_highlighter(make()); break; + case Language::CMakeCache: + set_syntax_highlighter(make()); + break; case Language::CSS: set_syntax_highlighter(make()); break; diff --git a/Userland/DevTools/HackStudio/Language.cpp b/Userland/DevTools/HackStudio/Language.cpp index 2d5e947fef6..d3a3081f24d 100644 --- a/Userland/DevTools/HackStudio/Language.cpp +++ b/Userland/DevTools/HackStudio/Language.cpp @@ -20,6 +20,8 @@ Language language_from_file(LexicalPath const& file) return Language::Cpp; if (extension == "cmake" || (extension == "txt" && file.title() == "CMakeLists")) return Language::CMake; + if (extension == "txt" && file.title() == "CMakeCache") + return Language::CMakeCache; if (extension == "js" || extension == "mjs" || extension == "json") return Language::JavaScript; if (extension == "html" || extension == "htm") @@ -64,6 +66,8 @@ DeprecatedString language_name_from_file(LexicalPath const& file) return "C++"; if (extension == "cmake" || (extension == "txt" && file.title() == "CMakeLists")) return "CMake"; + if (extension == "txt" && file.title() == "CMakeCache") + return "CMakeCache"; if (extension == "js" || extension == "mjs" || extension == "json") return "JavaScript"; if (extension == "gml") diff --git a/Userland/DevTools/HackStudio/Language.h b/Userland/DevTools/HackStudio/Language.h index 6713e52c05d..d7c68d60494 100644 --- a/Userland/DevTools/HackStudio/Language.h +++ b/Userland/DevTools/HackStudio/Language.h @@ -13,6 +13,7 @@ namespace HackStudio { enum class Language { Unknown, CMake, + CMakeCache, Cpp, CSS, JavaScript,