mirror of
https://github.com/neovim/neovim.git
synced 2026-03-21 16:09:42 +00:00
feat!: remove deprecated functions
This commit is contained in:
@@ -391,48 +391,6 @@ function M.get_node(opts)
|
||||
return root_lang_tree:named_node_for_range(ts_range, opts)
|
||||
end
|
||||
|
||||
--- Returns the smallest named node at the given position
|
||||
---
|
||||
---@param bufnr integer Buffer number (0 for current buffer)
|
||||
---@param row integer Position row
|
||||
---@param col integer Position column
|
||||
---@param opts table Optional keyword arguments:
|
||||
--- - lang string|nil Parser language
|
||||
--- - ignore_injections boolean Ignore injected languages (default true)
|
||||
---
|
||||
---@return TSNode | nil Node at the given position
|
||||
---@deprecated
|
||||
function M.get_node_at_pos(bufnr, row, col, opts)
|
||||
vim.deprecate('vim.treesitter.get_node_at_pos()', 'vim.treesitter.get_node()', '0.10')
|
||||
if bufnr == 0 then
|
||||
bufnr = api.nvim_get_current_buf()
|
||||
end
|
||||
local ts_range = { row, col, row, col }
|
||||
|
||||
opts = opts or {}
|
||||
|
||||
local root_lang_tree = M.get_parser(bufnr, opts.lang)
|
||||
if not root_lang_tree then
|
||||
return
|
||||
end
|
||||
|
||||
return root_lang_tree:named_node_for_range(ts_range, opts)
|
||||
end
|
||||
|
||||
--- Returns the smallest named node under the cursor
|
||||
---
|
||||
---@param winnr (integer|nil) Window handle or 0 for current window (default)
|
||||
---
|
||||
---@return string Name of node under the cursor
|
||||
---@deprecated
|
||||
function M.get_node_at_cursor(winnr)
|
||||
vim.deprecate('vim.treesitter.get_node_at_cursor()', 'vim.treesitter.get_node():type()', '0.10')
|
||||
winnr = winnr or 0
|
||||
local bufnr = api.nvim_win_get_buf(winnr)
|
||||
|
||||
return M.get_node({ bufnr = bufnr, ignore_injections = false }):type()
|
||||
end
|
||||
|
||||
--- Starts treesitter highlighting for a buffer
|
||||
---
|
||||
--- Can be used in an ftplugin or FileType autocommand.
|
||||
|
||||
Reference in New Issue
Block a user