mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 01:16:18 +04:00
Improve Edoc highlighting within Erlang
This highlights edoc within Erlang comments. The trick was to have the Erlang grammar consume newlines and then give them to EDoc in the injection to use so that line-wise elements could be parsed accurately.
This commit is contained in:
parent
a3f321a531
commit
452f7d071c
@ -1184,7 +1184,7 @@ language-server = { command = "erlang_ls" }
|
|||||||
|
|
||||||
[[grammar]]
|
[[grammar]]
|
||||||
name = "erlang"
|
name = "erlang"
|
||||||
source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "0e7d677d11a7379686c53c616825714ccb728059" }
|
source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "ce0ed253d72c199ab93caba7542b6f62075339c4" }
|
||||||
|
|
||||||
[[language]]
|
[[language]]
|
||||||
name = "kotlin"
|
name = "kotlin"
|
||||||
@ -1574,7 +1574,7 @@ indent = { tab-width = 4, unit = " " }
|
|||||||
|
|
||||||
[[grammar]]
|
[[grammar]]
|
||||||
name = "edoc"
|
name = "edoc"
|
||||||
source = { git = "https://github.com/the-mikedavis/tree-sitter-edoc", rev = "1691ec0aa7ad1ed9fa295590545f27e570d12d60" }
|
source = { git = "https://github.com/the-mikedavis/tree-sitter-edoc", rev = "74774af7b45dd9cefbf9510328fc6ff2374afc50" }
|
||||||
|
|
||||||
[[language]]
|
[[language]]
|
||||||
name = "jsdoc"
|
name = "jsdoc"
|
||||||
|
@ -48,3 +48,5 @@
|
|||||||
(language_identifier)
|
(language_identifier)
|
||||||
(quote_content)
|
(quote_content)
|
||||||
] @markup.raw.block
|
] @markup.raw.block
|
||||||
|
|
||||||
|
(parameter) @variable.parameter
|
||||||
|
@ -16,5 +16,5 @@
|
|||||||
(tag) @_tag
|
(tag) @_tag
|
||||||
(argument) @injection.content)
|
(argument) @injection.content)
|
||||||
(#eq? @_tag "@type")
|
(#eq? @_tag "@type")
|
||||||
(#set injection.language "erlang")
|
(#set! injection.language "erlang")
|
||||||
(#set injection.include-children))
|
(#set! injection.include-children))
|
||||||
|
@ -94,10 +94,6 @@
|
|||||||
(unary_operator operator: _ @operator)
|
(unary_operator operator: _ @operator)
|
||||||
["/" ":" "->"] @operator
|
["/" ":" "->"] @operator
|
||||||
|
|
||||||
(tripledot) @comment.discard
|
|
||||||
|
|
||||||
(comment) @comment
|
|
||||||
|
|
||||||
; Macros
|
; Macros
|
||||||
(macro
|
(macro
|
||||||
"?"+ @constant
|
"?"+ @constant
|
||||||
@ -112,8 +108,14 @@
|
|||||||
((variable) @comment.discard
|
((variable) @comment.discard
|
||||||
(#match? @comment.discard "^_"))
|
(#match? @comment.discard "^_"))
|
||||||
|
|
||||||
|
(tripledot) @comment.discard
|
||||||
|
|
||||||
|
[(comment) (line_comment) (shebang)] @comment
|
||||||
|
|
||||||
; Basic types
|
; Basic types
|
||||||
(variable) @variable
|
(variable) @variable
|
||||||
|
((atom) @constant.builtin.boolean
|
||||||
|
(#match? @constant.builtin.boolean "^(true|false)$"))
|
||||||
(atom) @string.special.symbol
|
(atom) @string.special.symbol
|
||||||
(string) @string
|
(string) @string
|
||||||
(character) @constant.character
|
(character) @constant.character
|
||||||
|
@ -1,2 +1,7 @@
|
|||||||
((comment_content) @injection.content
|
((line_comment (comment_content) @injection.content)
|
||||||
(#set! injection.language "edoc"))
|
(#set! injection.language "edoc")
|
||||||
|
(#set! injection.include-children)
|
||||||
|
(#set! injection.combined))
|
||||||
|
|
||||||
|
((comment (comment_content) @injection.content)
|
||||||
|
(#set! injection.language "comment"))
|
||||||
|
Loading…
Reference in New Issue
Block a user