mirror of
https://github.com/helix-editor/helix.git
synced 2025-04-02 02:17:44 +03:00
queries: Inject markdown into Rust doc comments
Co-authored-by: Nik Revenco <154856872+nik-rev@users.noreply.github.com>
This commit is contained in:
parent
ac88096c98
commit
813f771c0a
5 changed files with 30 additions and 1 deletions
|
@ -138,6 +138,7 @@
|
|||
| make | ✓ | | ✓ | |
|
||||
| markdoc | ✓ | | | `markdoc-ls` |
|
||||
| markdown | ✓ | | | `marksman`, `markdown-oxide` |
|
||||
| markdown-rustdoc | ✓ | | | |
|
||||
| markdown.inline | ✓ | | | |
|
||||
| matlab | ✓ | ✓ | ✓ | |
|
||||
| mermaid | ✓ | | | |
|
||||
|
|
|
@ -1704,6 +1704,15 @@ block-comment-tokens = { start = "<!--", end = "-->" }
|
|||
name = "markdown"
|
||||
source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-markdown", rev = "62516e8c78380e3b51d5b55727995d2c511436d8", subpath = "tree-sitter-markdown" }
|
||||
|
||||
[[language]]
|
||||
name = "markdown-rustdoc"
|
||||
scope = "source.markdown-rustdoc"
|
||||
grammar = "markdown"
|
||||
injection-regex = "markdown-rustdoc"
|
||||
file-types = []
|
||||
indent = { tab-width = 2, unit = " " }
|
||||
block-comment-tokens = { start = "<!--", end = "-->" }
|
||||
|
||||
[[language]]
|
||||
name = "markdown.inline"
|
||||
scope = "source.markdown.inline"
|
||||
|
|
1
runtime/queries/markdown-rustdoc/highlights.scm
Normal file
1
runtime/queries/markdown-rustdoc/highlights.scm
Normal file
|
@ -0,0 +1 @@
|
|||
; inherits: markdown
|
14
runtime/queries/markdown-rustdoc/injections.scm
Normal file
14
runtime/queries/markdown-rustdoc/injections.scm
Normal file
|
@ -0,0 +1,14 @@
|
|||
; inherits: markdown
|
||||
|
||||
; In Rust, it is common to have documentation code blocks not specify the
|
||||
; language, and it is assumed to be Rust if it is not specified.
|
||||
|
||||
(fenced_code_block
|
||||
(code_fence_content) @injection.content
|
||||
(#set! injection.language "rust")
|
||||
(#set! injection.include-unnamed-children))
|
||||
|
||||
(fenced_code_block
|
||||
(info_string
|
||||
(language) @injection.language)
|
||||
(code_fence_content) @injection.content (#set! injection.include-unnamed-children))
|
|
@ -1,6 +1,10 @@
|
|||
([(line_comment) (block_comment)] @injection.content
|
||||
([(line_comment !doc) (block_comment !doc)] @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((doc_comment) @injection.content
|
||||
(#set! injection.language "markdown-rustdoc")
|
||||
(#set! injection.combined))
|
||||
|
||||
((macro_invocation
|
||||
macro:
|
||||
[
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue