aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-07-01 11:08:06 +0200
committerGitHub <noreply@github.com>2023-07-01 11:08:06 +0200
commit11844dde81c41bded54f2383b57f8eef406f2736 (patch)
tree4e98199f68a27b793fecc62f3efd08a2f048d10b /runtime/doc
parent538b6c385391b4061d36530acea3fc3d20604358 (diff)
downloadrneovim-11844dde81c41bded54f2383b57f8eef406f2736.tar.gz
rneovim-11844dde81c41bded54f2383b57f8eef406f2736.tar.bz2
rneovim-11844dde81c41bded54f2383b57f8eef406f2736.zip
feat(treesitter): bundle markdown parser and queries (#22481)
* bundle split Markdown parser from https://github.com/MDeiml/tree-sitter-markdown * add queries from https://github.com/nvim-treesitter/nvim-treesitter/tree/main * upstream `#trim!` and `#inject-language!` directives Co-authored-by: dundargoc <gocdundar@gmail.com>
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/news.txt5
-rw-r--r--runtime/doc/treesitter.txt32
2 files changed, 36 insertions, 1 deletions
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 0a9b926b7f..5ee9cb7a14 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -101,6 +101,8 @@ The following new APIs and features were added.
• Implemented LSP inlay hints: |vim.lsp.inlay_hint()|
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_inlayHint
+• Bundled Markdown parser for treesitter highlighting and folding.
+
==============================================================================
CHANGED FEATURES *news-changed*
@@ -120,7 +122,8 @@ The following changes to existing APIs or features add new behavior.
• Automatic linting of treesitter query files (see |ft-query-plugin|).
Can be disabled via: >lua
vim.g.query_lint_on = {}
-< • Enabled treesitter highlighting for treesitter query files.
+<
+ • Enabled treesitter highlighting for treesitter query files.
• The `workspace/didChangeWatchedFiles` LSP client capability is now enabled
by default.
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt
index 28ab3ecd8e..7539417197 100644
--- a/runtime/doc/treesitter.txt
+++ b/runtime/doc/treesitter.txt
@@ -292,7 +292,39 @@ The following directives are built in:
Example: >query
((identifier) @constant (#offset! @constant 0 1 0 -1))
<
+ `gsub!` *treesitter-directive-gsub!*
+ Transforms the content of the node using a Lua pattern. This will set
+ a new `metadata[capture_id].text`.
+ Parameters: ~
+ {capture_id}
+ {pattern}
+
+ Example: >query
+ (#gsub! @_node ".*%.(.*)" "%1")
+<
+ `trim!` *treesitter-directive-trim!*
+ Trim blank lines from the end of the node. This will set a new
+ `metadata[capture_id].range`.
+
+ Parameters: ~
+ {capture_id}
+
+ Example: >query
+ (#inject-language! @_lang)
+<
+ `inject-language!` *treesitter-directive-inject-language!*
+ Set the injection language from the node text, interpreted first as a
+ language name, then (if a parser is not found) a filetype. Custom
+ aliases can be added via |vim.treesitter.language.register()|. This
+ will set a new `metadata[capture_id]['injection.language']`.
+
+ Parameters: ~
+ {capture_id}
+
+ Example: >query
+ (#inject-language! @_lang)
+<
Further directives can be added via |vim.treesitter.query.add_directive()|.
Use |vim.treesitter.query.list_directives()| to list all available directives.