summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFarbod Salamat-Zadeh <12140044+farbodsz@users.noreply.github.com>2021-07-01 01:43:08 +0100
committerGitHub <noreply@github.com>2021-07-01 00:43:08 +0000
commitefbd01f5391371cb9285993646376747f3dbd9ad (patch)
tree11cfdfb7c67c513ff8b8ee1dd982e0c45fd97014
parentcf768b0069f02ea4b3c35c25b96ef8502d8ff91f (diff)
Add common quasiquote highlights/injections for Haskell (#1440)
-rw-r--r--queries/haskell/highlights.scm7
-rw-r--r--queries/haskell/injections.scm57
2 files changed, 64 insertions, 0 deletions
diff --git a/queries/haskell/highlights.scm b/queries/haskell/highlights.scm
index 52fd4fbb..a0eecf97 100644
--- a/queries/haskell/highlights.scm
+++ b/queries/haskell/highlights.scm
@@ -122,3 +122,10 @@
; True or False
((constructor) @_bool (#match? @_bool "(True|False)")) @boolean
+
+
+;; ----------------------------------------------------------------------------
+;; Quasi-quotes
+
+(quoter) @function
+; Highlighting of quasiquote_body is handled by injections.scm
diff --git a/queries/haskell/injections.scm b/queries/haskell/injections.scm
new file mode 100644
index 00000000..b7277090
--- /dev/null
+++ b/queries/haskell/injections.scm
@@ -0,0 +1,57 @@
+;; -----------------------------------------------------------------------------
+;; General language injection
+
+(quasiquote
+ ((quoter) @language)
+ ((quasiquote_body) @content)
+)
+
+
+;; -----------------------------------------------------------------------------
+;; shakespeare library
+;; NOTE: doesn't support templating
+
+; TODO: add once CoffeeScript parser is added
+; ; CoffeeScript: Text.Coffee
+; (quasiquote
+; (quoter) @_name
+; (#eq? @_name "coffee")
+; ((quasiquote_body) @coffeescript)
+
+; CSS: Text.Cassius, Text.Lucius
+(quasiquote
+ (quoter) @_name
+ (#any-of? @_name "cassius" "lucius")
+ ((quasiquote_body) @css)
+)
+
+; HTML: Text.Hamlet
+(quasiquote
+ (quoter) @_name
+ (#any-of? @_name "shamlet" "xshamlet" "hamlet" "xhamlet" "ihamlet")
+ ((quasiquote_body) @html)
+)
+
+; JS: Text.Julius
+(quasiquote
+ (quoter) @_name
+ (#any-of? @_name "js" "julius")
+ ((quasiquote_body) @javascript)
+)
+
+; TS: Text.TypeScript
+(quasiquote
+ (quoter) @_name
+ (#any-of? @_name "tsc" "tscJSX")
+ ((quasiquote_body) @typescript)
+)
+
+
+;; -----------------------------------------------------------------------------
+;; HSX
+
+(quasiquote
+ (quoter) @_name
+ (#eq? @_name "hsx")
+ ((quasiquote_body) @html)
+)