mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 17:21:49 +00:00
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.
This commit is contained in:

committed by
Christian Clason

parent
267c7525f7
commit
d3193afc25
@@ -170,7 +170,12 @@ end
|
||||
|
||||
--- 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
|
||||
--- (`"`).
|
||||
---
|
||||
---@param lang string Language
|
||||
---@return table
|
||||
|
Reference in New Issue
Block a user