summaryrefslogtreecommitdiff
path: root/Userland/DevTools/HackStudio
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2021-10-21 21:45:55 +0100
committerAndreas Kling <kling@serenityos.org>2021-10-23 19:07:44 +0200
commit79522db5d02986d7185e08b4e46dde9c5bdfd309 (patch)
treef93be139fcff084a5c91f0aa0ca95129c32996f3 /Userland/DevTools/HackStudio
parentd2690e551c39d3aa956b979d06c700c1c1826de3 (diff)
downloadserenity-79522db5d02986d7185e08b4e46dde9c5bdfd309.zip
HackStudio: Add syntax-highlighting for CSS files
Diffstat (limited to 'Userland/DevTools/HackStudio')
-rw-r--r--Userland/DevTools/HackStudio/Editor.cpp4
-rw-r--r--Userland/DevTools/HackStudio/Language.cpp4
-rw-r--r--Userland/DevTools/HackStudio/Language.h1
3 files changed, 9 insertions, 0 deletions
diff --git a/Userland/DevTools/HackStudio/Editor.cpp b/Userland/DevTools/HackStudio/Editor.cpp
index d93a6509b0..46ba8c8a35 100644
--- a/Userland/DevTools/HackStudio/Editor.cpp
+++ b/Userland/DevTools/HackStudio/Editor.cpp
@@ -30,6 +30,7 @@
#include <LibJS/SyntaxHighlighter.h>
#include <LibMarkdown/Document.h>
#include <LibSQL/AST/SyntaxHighlighter.h>
+#include <LibWeb/CSS/SyntaxHighlighter/SyntaxHighlighter.h>
#include <LibWeb/DOM/Text.h>
#include <LibWeb/HTML/HTMLHeadElement.h>
#include <LibWeb/HTML/SyntaxHighlighter/SyntaxHighlighter.h>
@@ -594,6 +595,9 @@ void Editor::set_syntax_highlighter_for(const CodeDocument& document)
case Language::Cpp:
set_syntax_highlighter(make<Cpp::SyntaxHighlighter>());
break;
+ case Language::CSS:
+ set_syntax_highlighter(make<Web::CSS::SyntaxHighlighter>());
+ break;
case Language::GML:
set_syntax_highlighter(make<GUI::GMLSyntaxHighlighter>());
break;
diff --git a/Userland/DevTools/HackStudio/Language.cpp b/Userland/DevTools/HackStudio/Language.cpp
index ea20a39adf..229bfae64c 100644
--- a/Userland/DevTools/HackStudio/Language.cpp
+++ b/Userland/DevTools/HackStudio/Language.cpp
@@ -18,6 +18,8 @@ Language language_from_file_extension(const String& extension)
return Language::JavaScript;
if (extension == "html" || extension == "htm")
return Language::HTML;
+ if (extension == "css")
+ return Language::CSS;
if (extension == "gml")
return Language::GML;
if (extension == "ini")
@@ -60,6 +62,8 @@ String language_name_from_file_extension(const String& extension)
return "Markdown";
if (extension == "html" || extension == "htm")
return "HTML";
+ if (extension == "css")
+ return "CSS";
if (extension == "sql")
return "SQL";
if (extension == "txt")
diff --git a/Userland/DevTools/HackStudio/Language.h b/Userland/DevTools/HackStudio/Language.h
index 24806b115f..fc3e172c8f 100644
--- a/Userland/DevTools/HackStudio/Language.h
+++ b/Userland/DevTools/HackStudio/Language.h
@@ -12,6 +12,7 @@ namespace HackStudio {
enum class Language {
Unknown,
Cpp,
+ CSS,
JavaScript,
HTML,
GML,