fix(treesitter): add missing deprecate

This commit is contained in:
Lewis Russell 2023-03-24 16:31:30 +00:00 committed by GitHub
parent cbbf8bd666
commit ac7397f4a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 9 deletions

View File

@ -1,5 +1,4 @@
local Range = require('vim.treesitter._range')
local Query = require('vim.treesitter.query')
local api = vim.api
@ -105,7 +104,7 @@ local function get_folds_levels(bufnr, info, srow, erow)
local prev_stop = -1
vim.treesitter.get_parser(bufnr):for_each_tree(function(tree, ltree)
local query = vim.treesitter.query.get_query(ltree:lang(), 'folds')
local query = vim.treesitter.query.get(ltree:lang(), 'folds')
if not query then
return
end
@ -115,7 +114,7 @@ local function get_folds_levels(bufnr, info, srow, erow)
for id, node, metadata in query:iter_captures(tree:root(), bufnr, srow or 0, q_erow) do
if query.captures[id] == 'fold' then
local range = Query.get_range(node, bufnr, metadata[id])
local range = vim.treesitter.get_range(node, bufnr, metadata[id])
local start, _, stop, stop_col = Range.unpack4(range)
if stop_col == 0 then

View File

@ -196,12 +196,9 @@ function M.set(lang, query_name, text)
end
---@deprecated
---@param lang string Language to use for the query
---@param query_name string Name of the query (e.g. "highlights")
---
---@return Query|nil Parsed query
function M.get_query(lang, query_name)
return M.get(lang, query_name)
function M.get_query(...)
vim.deprecate('vim.treesitter.query.get_query()', 'vim.treesitter.query.get()', '0.10')
return M.get(...)
end
--- Returns the runtime query {query_name} for {lang}.