aboutsummaryrefslogtreecommitdiffstats
path: root/queries
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 /queries
parentdoc: link Installation wiki page in the README (diff)
downloadnvim-treesitter-efbd01f5391371cb9285993646376747f3dbd9ad.tar
nvim-treesitter-efbd01f5391371cb9285993646376747f3dbd9ad.tar.gz
nvim-treesitter-efbd01f5391371cb9285993646376747f3dbd9ad.tar.bz2
nvim-treesitter-efbd01f5391371cb9285993646376747f3dbd9ad.tar.lz
nvim-treesitter-efbd01f5391371cb9285993646376747f3dbd9ad.tar.xz
nvim-treesitter-efbd01f5391371cb9285993646376747f3dbd9ad.tar.zst
nvim-treesitter-efbd01f5391371cb9285993646376747f3dbd9ad.zip
Add common quasiquote highlights/injections for Haskell (#1440)
Diffstat (limited to 'queries')
-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 52fd4fbbd..a0eecf977 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 000000000..b72770907
--- /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)
+)