aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter/query.lua
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-04-30 11:01:54 +0200
committerGitHub <noreply@github.com>2023-04-30 11:01:54 +0200
commit668f16bac779ac52d7bd9452e6001a7a6d1e9965 (patch)
treeae8e2a079d122393436f1267e9a6a4c2fa78063d /runtime/lua/vim/treesitter/query.lua
parentfa20c12ba358066858d1d2cd20d21316fe4b467b (diff)
downloadrneovim-668f16bac779ac52d7bd9452e6001a7a6d1e9965.tar.gz
rneovim-668f16bac779ac52d7bd9452e6001a7a6d1e9965.tar.bz2
rneovim-668f16bac779ac52d7bd9452e6001a7a6d1e9965.zip
feat(treesitter): upstream query omnifunc from playground (#23394)
and set by default in `ftplugin/query.lua`
Diffstat (limited to 'runtime/lua/vim/treesitter/query.lua')
-rw-r--r--runtime/lua/vim/treesitter/query.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index 492bfd1ffb..93841bb31e 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -728,7 +728,7 @@ end
---
--- The found diagnostics are reported using |diagnostic-api|.
--- By default, the parser used for verification is determined by the containing folder
---- of the query file, e.g., if the path is `**/lua/highlights.scm`, the parser for the
+--- of the query file, e.g., if the path ends in `/lua/highlights.scm`, the parser for the
--- `lua` language will be used.
---@param buf (integer) Buffer handle
---@param opts (QueryLinterOpts|nil) Optional keyword arguments:
@@ -743,4 +743,14 @@ function M.lint(buf, opts)
end
end
+--- Omnifunc for completing node names and predicates in treesitter queries.
+---
+--- Use via
+--- <pre>lua
+--- vim.bo.omnifunc = 'v:lua.vim.treesitter.query.omnifunc'
+--- </pre>
+function M.omnifunc(findstart, base)
+ return require('vim.treesitter._query_linter').omnifunc(findstart, base)
+end
+
return M