Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
| gts | ✓ | ✓ | ✓ | ✓ | | `typescript-language-server`, `vscode-eslint-language-server`, `ember-language-server` |
| hare | ✓ | | | | | |
| haskell | ✓ | ✓ | | | | `haskell-language-server-wrapper` |
| haskell-literate | ✓ | | | | | `haskell-language-server-wrapper` |
| haskell-persistent | ✓ | | | | | |
| hcl | ✓ | ✓ | ✓ | | | `terraform-ls` |
| hdl | ✓ | | | | | `hdls` |
Expand Down
16 changes: 16 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,22 @@ indent = { tab-width = 2, unit = " " }
name = "haskell-persistent"
source = { git = "https://github.com/MercuryTechnologies/tree-sitter-haskell-persistent", rev = "58a6ccfd56d9f1de8fb9f77e6c42151f8f0d0f3d" }

[[language]]
name = "haskell-literate"
scope = "source.haskell-literate"
injection-regex = "lhs"
file-types = ["lhs"]
roots = ["Setup.hs", "stack.yaml", "cabal.project", "hie.yaml"]
shebangs = ["runhaskell", "stack"]
comment-token = "--"
block-comment-tokens = { start = "{-", end = "-}" }
language-servers = [ "haskell-language-server" ]
indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "haskell-literate"
source = { git = "https://github.com/LaurentRDC/tree-sitter-haskell-literate", rev = "8ad7bd1b1595f4cc1a4ccc775d4a3c460f43a596" }

[[language]]
name = "purescript"
scope = "source.purescript"
Expand Down
16 changes: 16 additions & 0 deletions runtime/queries/haskell-literate/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
; Bird track marker
(bird_line ">" @punctuation.special)

; LaTeX delimiters
(latex_begin) @keyword.directive
(latex_end) @keyword.directive

; Highlight LaTeX comments like comments
(latex_comment) @comment

; Markdown delimiters
(markdown_begin) @keyword.directive
(markdown_end) @keyword.directive

; Normal prose is not highlighted. Haskell code will be
; highlighted by the injected Haskell grammar
14 changes: 14 additions & 0 deletions runtime/queries/haskell-literate/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
; Inject Haskell parser into bird-style code lines
((bird_line
(haskell_code) @injection.content)
(#set! injection.language "haskell"))

; Inject Haskell parser into LaTeX code blocks
((latex_code_line
(haskell_code) @injection.content)
(#set! injection.language "haskell"))

; Inject Haskell parser into Markdown code blocks
((markdown_code_line
(haskell_code) @injection.content)
(#set! injection.language "haskell"))