diff options
| author | Riley Bruins <ribru17@hotmail.com> | 2024-09-19 13:08:22 -0700 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2024-10-11 18:15:07 +0200 |
| commit | d3193afc2559e7d84ed2d76664a650dc03b4c6ef (patch) | |
| tree | cfa3e37e11d158713ae01a691e03853509317e39 /runtime/doc | |
| parent | 267c7525f738cdd6024c39da758e885c026ffaaa (diff) | |
| download | rneovim-d3193afc2559e7d84ed2d76664a650dc03b4c6ef.tar.gz rneovim-d3193afc2559e7d84ed2d76664a650dc03b4c6ef.tar.bz2 rneovim-d3193afc2559e7d84ed2d76664a650dc03b4c6ef.zip | |
fix(treesitter): remove duplicate symbol names in language.inspect()
**Problems:**
- `vim.treesitter.language.inspect()` returns duplicate
symbol names, sometimes up to 6 of one kind in the case of `markdown`
- The list-like `symbols` table can have holes and is thus not even a
valid msgpack table anyway, mentioned in a test
**Solution:** Return symbols as a map, rather than a list, where field
names are the names of the symbol. The boolean value associated with the
field encodes whether or not the symbol is named.
Note that anonymous nodes are surrounded with double quotes (`"`) to
prevent potential collisions with named counterparts that have the same
identifier.
Diffstat (limited to 'runtime/doc')
| -rw-r--r-- | runtime/doc/treesitter.txt | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 805876172d..f9a98250ea 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -1150,8 +1150,13 @@ get_lang({filetype}) *vim.treesitter.language.get_lang()* inspect({lang}) *vim.treesitter.language.inspect()* Inspects the provided language. - Inspecting provides some useful information on the language like node - names, ... + Inspecting provides some useful information on the language like node and + field names, ABI version, 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 (`"`). Parameters: ~ • {lang} (`string`) Language |