on master help sign in
Add language support for persistent library syntax (#7261)
commit7c338429f845315fb276ff482f91b94b3102dbd8 authorBorys Lykah <lykahb@fastmail.com> dateSun 9 Jul 2023, 11:17 (3 years ago) parentc33795e
6 files changed+62
book/src/generated/lang-support.md+1 languages.toml+12 runtime/queries/haskell-persistent/folds.scm+3 runtime/queries/haskell-persistent/highlights.scm+37 runtime/queries/haskell-persistent/locals.scm+1 runtime/queries/haskell/injections.scm+8
book/src/generated/lang-support.md+1
@@ -59,6 +59,7 @@
5959| graphql | ✓ | | | |
6060| hare | ✓ | | | |
6161| haskell | ✓ | ✓ | | `haskell-language-server-wrapper` |
62+| haskell-persistent | ✓ | | | |
6263| hcl | ✓ | | ✓ | `terraform-ls` |
6364| heex | ✓ | ✓ | | `elixir-ls` |
6465| hosts | ✓ | | | |
languages.toml+12
@@ -955,6 +955,18 @@ indent = { tab-width = 2, unit = " " }
955955name = "haskell"
956956source = { git = "https://github.com/tree-sitter/tree-sitter-haskell", rev = "98fc7f59049aeb713ab9b72a8ff25dcaaef81087" }
957957
958+[[language]]
959+name = "haskell-persistent"
960+scope = "source.persistentmodels"
961+file-types = ["persistentmodels"]
962+roots = []
963+comment-token = "--"
964+indent = { tab-width = 2, unit = " " }
965+
966+[[grammar]]
967+name = "haskell-persistent"
968+source = { git = "https://github.com/MercuryTechnologies/tree-sitter-haskell-persistent", rev = "58a6ccfd56d9f1de8fb9f77e6c42151f8f0d0f3d" }
969+
958970[[language]]
959971name = "purescript"
960972scope = "source.purescript"
runtime/queries/haskell-persistent/folds.scmnew file+3
@@ -0,0 +1,3 @@
1+[
2+ (entity_definition)
3+] @fold
runtime/queries/haskell-persistent/highlights.scmnew file+37
@@ -0,0 +1,37 @@
1+;; ----------------------------------------------------------------------------
2+;; Literals and comments
3+
4+(integer) @constant.numeric.integer
5+(float) @constant.numeric.float
6+(char) @constant.character
7+(string) @string
8+(attribute_name) @attribute
9+(attribute_exclamation_mark) @attribute
10+
11+(con_unit) @constant.builtin ; unit, as in ()
12+
13+(comment) @comment
14+
15+;; ----------------------------------------------------------------------------
16+;; Keywords, operators, includes
17+
18+[
19+ "Id"
20+ "Primary"
21+ "Foreign"
22+ "deriving"
23+] @keyword
24+
25+"=" @operator
26+
27+;; ----------------------------------------------------------------------------
28+;; Functions and variables
29+
30+(variable) @variable
31+
32+;; ----------------------------------------------------------------------------
33+;; Types
34+
35+(type) @type
36+
37+(constructor) @constructor
runtime/queries/haskell-persistent/locals.scmnew file+1
@@ -0,0 +1 @@
1+(fields (variable)) @local.definition
runtime/queries/haskell/injections.scm+8
@@ -1,6 +1,14 @@
11((comment) @injection.content
22 (#set! injection.language "comment"))
33
4+(quasiquote
5+ (quoter) @_quoter
6+ ((quasiquote_body) @injection.content
7+ (#match? @_quoter "(persistWith|persistLowerCase|persistUpperCase)")
8+ (#set! injection.language "haskell-persistent")
9+ )
10+)
11+
412(quasiquote
513 (quoter) @injection.language
614 (quasiquote_body) @injection.content)