mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 12:45:17 -07:00
Merge 4f5745aa8d
into 02bc40c194
This commit is contained in:
commit
f5b29edfec
@ -1433,16 +1433,26 @@ Query:iter_matches({node}, {source}, {start}, {stop}, {opts})
|
|||||||
(`fun(): integer, table<integer, TSNode[]>, vim.treesitter.query.TSMetadata`)
|
(`fun(): integer, table<integer, TSNode[]>, vim.treesitter.query.TSMetadata`)
|
||||||
pattern id, match, metadata
|
pattern id, match, metadata
|
||||||
|
|
||||||
set({lang}, {query_name}, {text}) *vim.treesitter.query.set()*
|
set({lang}, {query_name}, {text}, {opts}) *vim.treesitter.query.set()*
|
||||||
Sets the runtime query named {query_name} for {lang}
|
Sets the runtime query named {query_name} for {lang}
|
||||||
|
|
||||||
This allows users to override any runtime files and/or configuration set
|
This allows users to override or extend any runtime files and/or
|
||||||
by plugins.
|
configuration set by plugins.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
• {lang} (`string`) Language to use for the query
|
• {lang} (`string`) Language to use for the query
|
||||||
• {query_name} (`string`) Name of the query (e.g., "highlights")
|
• {query_name} (`string`) Name of the query (e.g., "highlights")
|
||||||
• {text} (`string`) Query text (unparsed).
|
• {text} (`string`) Query text (unparsed).
|
||||||
|
• {opts} (`table?`) A table with the following fields:
|
||||||
|
• {bufnr}? (`integer`) Buffer this query should apply to
|
||||||
|
(`0` for current buffer, `nil` for all buffers for
|
||||||
|
{lang}).
|
||||||
|
• {inherits}? (`string|string[]`) Language(s) this query
|
||||||
|
should inherit from (see
|
||||||
|
|treesitter-query-modeline-inherits|).
|
||||||
|
• {extends}? (`boolean`) Whether the query should be an
|
||||||
|
extension query (see
|
||||||
|
|treesitter-query-modeline-extends|).
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
@ -195,15 +195,28 @@ local explicit_queries = setmetatable({}, {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--- @class vim.treesitter.query.set.Opts
|
||||||
|
--- @inlinedoc
|
||||||
|
---
|
||||||
|
--- Buffer this query should apply to (`0` for current buffer, `nil` for all buffers for {lang}).
|
||||||
|
--- @field bufnr? integer
|
||||||
|
---
|
||||||
|
--- Language(s) this query should inherit from (see |treesitter-query-modeline-inherits|).
|
||||||
|
--- @field inherits? string|string[]
|
||||||
|
---
|
||||||
|
--- Whether the query should be an extension query (see |treesitter-query-modeline-extends|).
|
||||||
|
--- @field extends? boolean
|
||||||
|
|
||||||
--- Sets the runtime query named {query_name} for {lang}
|
--- Sets the runtime query named {query_name} for {lang}
|
||||||
---
|
---
|
||||||
--- This allows users to override any runtime files and/or configuration
|
--- This allows users to override or extend any runtime files and/or configuration
|
||||||
--- set by plugins.
|
--- set by plugins.
|
||||||
---
|
---
|
||||||
---@param lang string Language to use for the query
|
---@param lang string Language to use for the query
|
||||||
---@param query_name string Name of the query (e.g., "highlights")
|
---@param query_name string Name of the query (e.g., "highlights")
|
||||||
---@param text string Query text (unparsed).
|
---@param text string Query text (unparsed).
|
||||||
function M.set(lang, query_name, text)
|
---@param opts? vim.treesitter.query.set.Opts
|
||||||
|
function M.set(lang, query_name, text, opts)
|
||||||
explicit_queries[lang][query_name] = M.parse(lang, text)
|
explicit_queries[lang][query_name] = M.parse(lang, text)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user