mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
docs: fix vim.treesitter tags
Problem: Help tags like vim.treesitter.language.add() are confusing because `vim.treesitter.language` is (thankfully) not a user-facing module. Solution: Ignore the "fstem" when generating "treesitter" tags.
This commit is contained in:
@@ -58,7 +58,9 @@ function TSHighlighterQuery:query()
|
||||
return self._query
|
||||
end
|
||||
|
||||
--- Creates a new highlighter using @param tree
|
||||
---@private
|
||||
---
|
||||
--- Creates a highlighter for `tree`.
|
||||
---
|
||||
---@param tree LanguageTree parser object to use for highlighting
|
||||
---@param opts (table|nil) Configuration of the highlighter:
|
||||
|
||||
@@ -38,18 +38,16 @@ local LanguageTree = {}
|
||||
|
||||
LanguageTree.__index = LanguageTree
|
||||
|
||||
--- A |LanguageTree| holds the treesitter parser for a given language {lang} used
|
||||
--- to parse a buffer. As the buffer may contain injected languages, the LanguageTree
|
||||
--- needs to store parsers for these child languages as well (which in turn may contain
|
||||
--- child languages themselves, hence the name).
|
||||
--- @private
|
||||
---
|
||||
---@param source (integer|string) Buffer or a string of text to parse
|
||||
---@param lang string Root language this tree represents
|
||||
---@param opts (table|nil) Optional keyword arguments:
|
||||
--- - injections table Mapping language to injection query strings.
|
||||
--- This is useful for overriding the built-in
|
||||
--- runtime file searching for the injection language
|
||||
--- query per language.
|
||||
--- |LanguageTree| contains a tree of parsers: the root treesitter parser for {lang} and any
|
||||
--- "injected" language parsers, which themselves may inject other languages, recursively.
|
||||
---
|
||||
---@param source (integer|string) Buffer or text string to parse
|
||||
---@param lang string Root language of this tree
|
||||
---@param opts (table|nil) Optional arguments:
|
||||
--- - injections table Map of language to injection query strings. Overrides the
|
||||
--- built-in runtime file searching for language injections.
|
||||
---@return LanguageTree parser object
|
||||
function LanguageTree.new(source, lang, opts)
|
||||
language.add(lang)
|
||||
|
||||
@@ -273,8 +273,7 @@ end
|
||||
---@param 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()|.
|
||||
--- set to `metadata[capture_id]` when using |vim.treesitter.add_directive()|.
|
||||
---@return (string[]|string|nil)
|
||||
function M.get_node_text(node, source, opts)
|
||||
opts = opts or {}
|
||||
@@ -486,7 +485,7 @@ local directive_handlers = {
|
||||
---
|
||||
---@param name string Name of the predicate, without leading #
|
||||
---@param handler function(match:table<string,TSNode>, pattern:string, bufnr:number, predicate:string[])
|
||||
--- - see |vim.treesitter.query.add_directive()| for argument meanings
|
||||
--- - see |vim.treesitter.add_directive()| for argument meanings
|
||||
---@param force boolean|nil
|
||||
function M.add_predicate(name, handler, force)
|
||||
if predicate_handlers[name] and not force then
|
||||
|
||||
Reference in New Issue
Block a user