mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	feat!: remove deprecated functions
This commit is contained in:
		| @@ -908,12 +908,6 @@ do | |||||||
|   end |   end | ||||||
| end | end | ||||||
|  |  | ||||||
| ---@private |  | ||||||
| function vim.pretty_print(...) |  | ||||||
|   vim.deprecate('vim.pretty_print()', 'vim.print()', '0.10') |  | ||||||
|   return vim.print(...) |  | ||||||
| end |  | ||||||
|  |  | ||||||
| --- "Pretty prints" the given arguments and returns them unmodified. | --- "Pretty prints" the given arguments and returns them unmodified. | ||||||
| --- | --- | ||||||
| --- Example: | --- Example: | ||||||
|   | |||||||
| @@ -28,16 +28,6 @@ local function request(method, params, handler) | |||||||
|   return vim.lsp.buf_request(0, method, params, handler) |   return vim.lsp.buf_request(0, method, params, handler) | ||||||
| end | end | ||||||
|  |  | ||||||
| --- Checks whether the language servers attached to the current buffer are |  | ||||||
| --- ready. |  | ||||||
| --- |  | ||||||
| ---@return boolean : if server responds. |  | ||||||
| ---@deprecated |  | ||||||
| function M.server_ready() |  | ||||||
|   vim.deprecate('vim.lsp.buf.server_ready()', nil, '0.10') |  | ||||||
|   return not not vim.lsp.buf_notify(0, 'window/progress', {}) |  | ||||||
| end |  | ||||||
|  |  | ||||||
| --- Displays hover information about the symbol under the cursor in a floating | --- Displays hover information about the symbol under the cursor in a floating | ||||||
| --- window. Calling the function twice will jump into the floating window. | --- window. Calling the function twice will jump into the floating window. | ||||||
| function M.hover() | function M.hover() | ||||||
|   | |||||||
| @@ -391,48 +391,6 @@ function M.get_node(opts) | |||||||
|   return root_lang_tree:named_node_for_range(ts_range, opts) |   return root_lang_tree:named_node_for_range(ts_range, opts) | ||||||
| end | 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 | --- Starts treesitter highlighting for a buffer | ||||||
| --- | --- | ||||||
| --- Can be used in an ftplugin or FileType autocommand. | --- Can be used in an ftplugin or FileType autocommand. | ||||||
|   | |||||||
| @@ -150,14 +150,4 @@ function M.inspect(lang) | |||||||
|   return vim._ts_inspect_language(lang) |   return vim._ts_inspect_language(lang) | ||||||
| end | end | ||||||
|  |  | ||||||
| ---@deprecated |  | ||||||
| function M.inspect_language(...) |  | ||||||
|   vim.deprecate( |  | ||||||
|     'vim.treesitter.language.inspect_language()', |  | ||||||
|     'vim.treesitter.language.inspect()', |  | ||||||
|     '0.10' |  | ||||||
|   ) |  | ||||||
|   return M.inspect(...) |  | ||||||
| end |  | ||||||
|  |  | ||||||
| return M | return M | ||||||
|   | |||||||
| @@ -84,16 +84,6 @@ local function add_included_lang(base_langs, lang, ilang) | |||||||
|   return false |   return false | ||||||
| end | end | ||||||
|  |  | ||||||
| ---@deprecated |  | ||||||
| function M.get_query_files(...) |  | ||||||
|   vim.deprecate( |  | ||||||
|     'vim.treesitter.query.get_query_files()', |  | ||||||
|     'vim.treesitter.query.get_files()', |  | ||||||
|     '0.10' |  | ||||||
|   ) |  | ||||||
|   return M.get_files(...) |  | ||||||
| end |  | ||||||
|  |  | ||||||
| --- Gets the list of files used to make up a query | --- Gets the list of files used to make up a query | ||||||
| --- | --- | ||||||
| ---@param lang string Language to get query for | ---@param lang string Language to get query for | ||||||
| @@ -204,12 +194,6 @@ local explicit_queries = setmetatable({}, { | |||||||
|   end, |   end, | ||||||
| }) | }) | ||||||
|  |  | ||||||
| ---@deprecated |  | ||||||
| function M.set_query(...) |  | ||||||
|   vim.deprecate('vim.treesitter.query.set_query()', 'vim.treesitter.query.set()', '0.10') |  | ||||||
|   M.set(...) |  | ||||||
| end |  | ||||||
|  |  | ||||||
| --- 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 any runtime files and/or configuration | ||||||
| @@ -222,12 +206,6 @@ function M.set(lang, query_name, text) | |||||||
|   explicit_queries[lang][query_name] = M.parse(lang, text) |   explicit_queries[lang][query_name] = M.parse(lang, text) | ||||||
| end | end | ||||||
|  |  | ||||||
| ---@deprecated |  | ||||||
| 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}. | --- Returns the runtime query {query_name} for {lang}. | ||||||
| --- | --- | ||||||
| ---@param lang string Language to use for the query | ---@param lang string Language to use for the query | ||||||
| @@ -249,12 +227,6 @@ M.get = vim.func._memoize('concat-2', function(lang, query_name) | |||||||
|   return M.parse(lang, query_string) |   return M.parse(lang, query_string) | ||||||
| end) | end) | ||||||
|  |  | ||||||
| ---@deprecated |  | ||||||
| function M.parse_query(...) |  | ||||||
|   vim.deprecate('vim.treesitter.query.parse_query()', 'vim.treesitter.query.parse()', '0.10') |  | ||||||
|   return M.parse(...) |  | ||||||
| end |  | ||||||
|  |  | ||||||
| --- Parse {query} as a string. (If the query is in a file, the caller | --- Parse {query} as a string. (If the query is in a file, the caller | ||||||
| --- should read the contents into a string before calling). | --- should read the contents into a string before calling). | ||||||
| --- | --- | ||||||
| @@ -280,18 +252,6 @@ M.parse = vim.func._memoize('concat-2', function(lang, query) | |||||||
|   return Query.new(lang, ts_query) |   return Query.new(lang, ts_query) | ||||||
| end) | end) | ||||||
|  |  | ||||||
| ---@deprecated |  | ||||||
| function M.get_range(...) |  | ||||||
|   vim.deprecate('vim.treesitter.query.get_range()', 'vim.treesitter.get_range()', '0.10') |  | ||||||
|   return vim.treesitter.get_range(...) |  | ||||||
| end |  | ||||||
|  |  | ||||||
| ---@deprecated |  | ||||||
| function M.get_node_text(...) |  | ||||||
|   vim.deprecate('vim.treesitter.query.get_node_text()', 'vim.treesitter.get_node_text()', '0.10') |  | ||||||
|   return vim.treesitter.get_node_text(...) |  | ||||||
| end |  | ||||||
|  |  | ||||||
| --- Implementations of predicates that can optionally be prefixed with "any-". | --- Implementations of predicates that can optionally be prefixed with "any-". | ||||||
| --- | --- | ||||||
| --- These functions contain the implementations for each predicate, correctly | --- These functions contain the implementations for each predicate, correctly | ||||||
|   | |||||||
| @@ -50,7 +50,7 @@ describe('treesitter node API', function() | |||||||
|         lang = 'lua', |         lang = 'lua', | ||||||
|       }) |       }) | ||||||
|     ]]) |     ]]) | ||||||
|     eq('foo', lua_eval('vim.treesitter.query.get_node_text(node, 0)')) |     eq('foo', lua_eval('vim.treesitter.get_node_text(node, 0)')) | ||||||
|     eq('identifier', lua_eval('node:type()')) |     eq('identifier', lua_eval('node:type()')) | ||||||
|   end) |   end) | ||||||
|  |  | ||||||
| @@ -62,14 +62,13 @@ describe('treesitter node API', function() | |||||||
|     ]]) |     ]]) | ||||||
|  |  | ||||||
|     exec_lua([[ |     exec_lua([[ | ||||||
|       query = require"vim.treesitter.query" |  | ||||||
|       parser = vim.treesitter.get_parser(0, "c") |       parser = vim.treesitter.get_parser(0, "c") | ||||||
|       tree = parser:parse()[1] |       tree = parser:parse()[1] | ||||||
|       root = tree:root() |       root = tree:root() | ||||||
|       lang = vim.treesitter.language.inspect('c') |       lang = vim.treesitter.language.inspect('c') | ||||||
|  |  | ||||||
|       function node_text(node) |       function node_text(node) | ||||||
|         return query.get_node_text(node, 0) |         return vim.treesitter.get_node_text(node, 0) | ||||||
|       end |       end | ||||||
|     ]]) |     ]]) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -563,7 +563,7 @@ end]] | |||||||
|       local function is_main(match, pattern, bufnr, predicate) |       local function is_main(match, pattern, bufnr, predicate) | ||||||
|         local nodes = match[ predicate[2] ] |         local nodes = match[ predicate[2] ] | ||||||
|         for _, node in ipairs(nodes) do |         for _, node in ipairs(nodes) do | ||||||
|           if query.get_node_text(node, bufnr) == 'main' then |           if vim.treesitter.get_node_text(node, bufnr) == 'main' then | ||||||
|             return true |             return true | ||||||
|           end |           end | ||||||
|         end |         end | ||||||
| @@ -602,7 +602,7 @@ end]] | |||||||
|       local function is_main(match, pattern, bufnr, predicate) |       local function is_main(match, pattern, bufnr, predicate) | ||||||
|         local node = match[ predicate[2] ] |         local node = match[ predicate[2] ] | ||||||
|  |  | ||||||
|         return query.get_node_text(node, bufnr) == 'main' |         return vim.treesitter.get_node_text(node, bufnr) == 'main' | ||||||
|       end |       end | ||||||
|  |  | ||||||
|       local parser = vim.treesitter.get_parser(0, "c") |       local parser = vim.treesitter.get_parser(0, "c") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 dundargoc
					dundargoc