From bb8845340b1b9c2180fb19f049ff9deff5857d99 Mon Sep 17 00:00:00 2001 From: figsoda Date: Thu, 21 Jul 2022 12:08:37 +0100 Subject: feat(treesitter): allow capture text to be transformed Co-authored-by: Lewis Russell --- runtime/doc/news.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 5c234677ef..7c3f295560 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -151,6 +151,9 @@ The following new APIs or features were added. • |:highlight| now supports an additional attribute "altfont". +• Treesitter captures can now be transformed by directives. This will allow + more complicated dynamic language injections. + ============================================================================== CHANGED FEATURES *news-changes* -- cgit From e1d5ad1cb87d43c3d75619e239312d4ab2029b45 Mon Sep 17 00:00:00 2001 From: figsoda Date: Mon, 26 Dec 2022 16:10:59 -0500 Subject: feat(treesitter): add metadata option for get_node_text --- runtime/doc/news.txt | 3 +++ runtime/doc/treesitter.txt | 3 +++ 2 files changed, 6 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 7c3f295560..b438595b5f 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -154,6 +154,9 @@ The following new APIs or features were added. • Treesitter captures can now be transformed by directives. This will allow more complicated dynamic language injections. +• |vim.treesitter.query.get_node_text()| now accepts a `metadata` option for + writing custom directives using |vim.treesitter.query.add_directive()|. + ============================================================================== CHANGED FEATURES *news-changes* diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 7bc9f3f9a7..693804497d 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -746,6 +746,9 @@ get_node_text({node}, {source}, {opts}) • {opts} (table|nil) Optional parameters. • concat: (boolean) Concatenate result in a string (default true) + • metadata (table) Metadata of a specific capture. This + would be set to `metadata[capture_id]` when using + |vim.treesitter.query.add_directive()|. Return: ~ (string[]|string|nil) -- cgit