Skip to content

Commit

Permalink
Add language support for persistent library syntax (helix-editor#7261)
Browse files Browse the repository at this point in the history
  • Loading branch information
lykahb authored and Schuyler Mortimer committed Jul 10, 2024
1 parent 9f414fa commit e5df30f
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
| graphql || | | |
| hare || | | |
| haskell ||| | `haskell-language-server-wrapper` |
| haskell-persistent || | | |
| hcl || || `terraform-ls` |
| heex ||| | `elixir-ls` |
| hosts || | | |
Expand Down
12 changes: 12 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,18 @@ indent = { tab-width = 2, unit = " " }
name = "haskell"
source = { git = "https://github.com/tree-sitter/tree-sitter-haskell", rev = "98fc7f59049aeb713ab9b72a8ff25dcaaef81087" }

[[language]]
name = "haskell-persistent"
scope = "source.persistentmodels"
file-types = ["persistentmodels"]
roots = []
comment-token = "--"
indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "haskell-persistent"
source = { git = "https://github.com/MercuryTechnologies/tree-sitter-haskell-persistent", rev = "58a6ccfd56d9f1de8fb9f77e6c42151f8f0d0f3d" }

[[language]]
name = "purescript"
scope = "source.purescript"
Expand Down
3 changes: 3 additions & 0 deletions runtime/queries/haskell-persistent/folds.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
(entity_definition)
] @fold
37 changes: 37 additions & 0 deletions runtime/queries/haskell-persistent/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
;; ----------------------------------------------------------------------------
;; Literals and comments

(integer) @constant.numeric.integer
(float) @constant.numeric.float
(char) @constant.character
(string) @string
(attribute_name) @attribute
(attribute_exclamation_mark) @attribute

(con_unit) @constant.builtin ; unit, as in ()

(comment) @comment

;; ----------------------------------------------------------------------------
;; Keywords, operators, includes

[
"Id"
"Primary"
"Foreign"
"deriving"
] @keyword

"=" @operator

;; ----------------------------------------------------------------------------
;; Functions and variables

(variable) @variable

;; ----------------------------------------------------------------------------
;; Types

(type) @type

(constructor) @constructor
1 change: 1 addition & 0 deletions runtime/queries/haskell-persistent/locals.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(fields (variable)) @local.definition
8 changes: 8 additions & 0 deletions runtime/queries/haskell/injections.scm
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
((comment) @injection.content
(#set! injection.language "comment"))

(quasiquote
(quoter) @_quoter
((quasiquote_body) @injection.content
(#match? @_quoter "(persistWith|persistLowerCase|persistUpperCase)")
(#set! injection.language "haskell-persistent")
)
)

(quasiquote
(quoter) @injection.language
(quasiquote_body) @injection.content)

0 comments on commit e5df30f

Please sign in to comment.