aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter/language.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2025-03-01 15:51:09 +0000
committerGitHub <noreply@github.com>2025-03-01 15:51:09 +0000
commitec8922978eb14fe62671628bb25215743712eac0 (patch)
treed47554beaef78ec4f0ca988adc48f3e2336f38c2 /runtime/lua/vim/treesitter/language.lua
parent48e6147e64b819d2a4130697bb348dcd368a4391 (diff)
downloadrneovim-ec8922978eb14fe62671628bb25215743712eac0.tar.gz
rneovim-ec8922978eb14fe62671628bb25215743712eac0.tar.bz2
rneovim-ec8922978eb14fe62671628bb25215743712eac0.zip
feat(treesitter): add more metadata to `language.inspect()` (#32657)
Problem: No way to check the version of a treesitter parser. Solution: Add version metadata (ABI 15 parsers only) as well as parser state count and supertype information (ABI 15) in `vim.treesitter.language.inspect()`. Also graduate the `abi_version` field, as this is now the official upstream name. --------- Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Diffstat (limited to 'runtime/lua/vim/treesitter/language.lua')
-rw-r--r--runtime/lua/vim/treesitter/language.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/lua/vim/treesitter/language.lua b/runtime/lua/vim/treesitter/language.lua
index 38d309a102..f70f99421c 100644
--- a/runtime/lua/vim/treesitter/language.lua
+++ b/runtime/lua/vim/treesitter/language.lua
@@ -168,13 +168,17 @@ end
--- Inspects the provided language.
---
---- Inspecting provides some useful information on the language like node and field names, ABI
---- version, and whether the language came from a WASM module.
+--- Inspecting provides some useful information on the language like ABI version, parser state count
+--- (a measure of parser complexity), node and field names, and whether the language came from a
+--- WASM module.
---
--- Node names are returned in a table mapping each node name to a `boolean` indicating whether or
--- not the node is named (i.e., not anonymous). Anonymous nodes are surrounded with double quotes
--- (`"`).
---
+--- For ABI 15 parsers, also show parser metadata (major, minor, patch version) and a table of
+--- supertypes with their respective subtypes.
+---
---@param lang string Language
---@return TSLangInfo
function M.inspect(lang)