HackStudio: Enable CMakeCache.txt highlighting

This commit is contained in:
Sam Atkins 2023-03-07 20:52:07 +00:00 committed by Linus Groh
parent c6a2e8eb08
commit b1ce852c37
Notes: sideshowbarker 2024-07-17 00:47:29 +09:00
3 changed files with 9 additions and 0 deletions

View file

@ -14,6 +14,7 @@
#include <AK/Debug.h>
#include <AK/JsonParser.h>
#include <AK/LexicalPath.h>
#include <LibCMake/CMakeCache/SyntaxHighlighter.h>
#include <LibCMake/SyntaxHighlighter.h>
#include <LibConfig/Client.h>
#include <LibCore/DeprecatedFile.h>
@ -641,6 +642,9 @@ void Editor::set_syntax_highlighter_for(CodeDocument const& document)
case Language::CMake:
set_syntax_highlighter(make<CMake::SyntaxHighlighter>());
break;
case Language::CMakeCache:
set_syntax_highlighter(make<CMake::Cache::SyntaxHighlighter>());
break;
case Language::CSS:
set_syntax_highlighter(make<Web::CSS::SyntaxHighlighter>());
break;

View file

@ -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")

View file

@ -13,6 +13,7 @@ namespace HackStudio {
enum class Language {
Unknown,
CMake,
CMakeCache,
Cpp,
CSS,
JavaScript,