mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	| @@ -3584,7 +3584,7 @@ count({comp}, {expr} [, {ic} [, {start}]])			*count()* | |||||||
|  |  | ||||||
| 		Can also be used as a |method|: > | 		Can also be used as a |method|: > | ||||||
| 			mylist->count(val) | 			mylist->count(val) | ||||||
|  | < | ||||||
| 							*cscope_connection()* | 							*cscope_connection()* | ||||||
| cscope_connection([{num} , {dbpath} [, {prepend}]]) | cscope_connection([{num} , {dbpath} [, {prepend}]]) | ||||||
| 		Checks for the existence of a |cscope| connection.  If no | 		Checks for the existence of a |cscope| connection.  If no | ||||||
| @@ -3937,7 +3937,7 @@ exepath({expr})						*exepath()* | |||||||
|  |  | ||||||
| 		Can also be used as a |method|: > | 		Can also be used as a |method|: > | ||||||
| 			GetCommand()->exepath() | 			GetCommand()->exepath() | ||||||
|  | < | ||||||
| 							*exists()* | 							*exists()* | ||||||
| exists({expr})	The result is a Number, which is |TRUE| if {expr} is | exists({expr})	The result is a Number, which is |TRUE| if {expr} is | ||||||
| 		defined, zero otherwise. | 		defined, zero otherwise. | ||||||
| @@ -4483,7 +4483,7 @@ foldlevel({lnum})					*foldlevel()* | |||||||
|  |  | ||||||
| 		Can also be used as a |method|: > | 		Can also be used as a |method|: > | ||||||
| 			GetLnum()->foldlevel() | 			GetLnum()->foldlevel() | ||||||
|  | < | ||||||
| 							*foldtext()* | 							*foldtext()* | ||||||
| foldtext()	Returns a String, to be displayed for a closed fold.  This is | foldtext()	Returns a String, to be displayed for a closed fold.  This is | ||||||
| 		the default function used for the 'foldtext' option and should | 		the default function used for the 'foldtext' option and should | ||||||
|   | |||||||
| @@ -575,9 +575,6 @@ buf_request_sync({bufnr}, {method}, {params}, {timeout_ms}) | |||||||
|                     error, returns `(nil, err)` where `err` is a string |                     error, returns `(nil, err)` where `err` is a string | ||||||
|                     describing the failure reason. |                     describing the failure reason. | ||||||
|  |  | ||||||
| check_clients_closed()                        *vim.lsp.check_clients_closed()* |  | ||||||
|                 TODO: Documentation |  | ||||||
|  |  | ||||||
| client()                                                      *vim.lsp.client* | client()                                                      *vim.lsp.client* | ||||||
|                 LSP client object. You can get an active client object via |                 LSP client object. You can get an active client object via | ||||||
|                 |vim.lsp.get_client_by_id()| or |                 |vim.lsp.get_client_by_id()| or | ||||||
| @@ -650,12 +647,21 @@ client_is_stopped({client_id})                   *vim.lsp.client_is_stopped()* | |||||||
|                 Return: ~ |                 Return: ~ | ||||||
|                     true if client is stopped, false otherwise. |                     true if client is stopped, false otherwise. | ||||||
|  |  | ||||||
| flush({client})                                              *vim.lsp.flush()* |  | ||||||
|                 TODO: Documentation |  | ||||||
|  |  | ||||||
|                                             *vim.lsp.for_each_buffer_client()* |                                             *vim.lsp.for_each_buffer_client()* | ||||||
| for_each_buffer_client({bufnr}, {fn}) | for_each_buffer_client({bufnr}, {fn}) | ||||||
|                 TODO: Documentation |                 Invokes a function for each LSP client attached to a buffer. | ||||||
|  |  | ||||||
|  |                 Parameters: ~ | ||||||
|  |                     {bufnr}  number Buffer number | ||||||
|  |                     {fn}     function Function to run on each client attached | ||||||
|  |                              to buffer {bufnr}. The function takes the client, | ||||||
|  |                              client ID, and buffer number as arguments. | ||||||
|  |                              Example: > | ||||||
|  |  | ||||||
|  |                                vim.lsp.for_each_buffer_client(0, function(client, client_id, bufnr) | ||||||
|  |                                  print(vim.inspect(client)) | ||||||
|  |                                end) | ||||||
|  | < | ||||||
|  |  | ||||||
| formatexpr({opts})                                      *vim.lsp.formatexpr()* | formatexpr({opts})                                      *vim.lsp.formatexpr()* | ||||||
|                 Provides an interface between the built-in client and a |                 Provides an interface between the built-in client and a | ||||||
| @@ -721,16 +727,6 @@ omnifunc({findstart}, {base})                             *vim.lsp.omnifunc()* | |||||||
|                     |complete-items| |                     |complete-items| | ||||||
|                     |CompleteDone| |                     |CompleteDone| | ||||||
|  |  | ||||||
|                                                            *vim.lsp.prepare()* |  | ||||||
| prepare({bufnr}, {firstline}, {lastline}, {new_lastline}) |  | ||||||
|                 TODO: Documentation |  | ||||||
|  |  | ||||||
| reset({client_id})                                           *vim.lsp.reset()* |  | ||||||
|                 TODO: Documentation |  | ||||||
|  |  | ||||||
| reset_buf({client}, {bufnr})                             *vim.lsp.reset_buf()* |  | ||||||
|                 TODO: Documentation |  | ||||||
|  |  | ||||||
| set_log_level({level})                               *vim.lsp.set_log_level()* | set_log_level({level})                               *vim.lsp.set_log_level()* | ||||||
|                 Sets the global log level for LSP logging. |                 Sets the global log level for LSP logging. | ||||||
|  |  | ||||||
| @@ -995,9 +991,9 @@ document_highlight()                        *vim.lsp.buf.document_highlight()* | |||||||
|                 triggered by a key mapping or by events such as `CursorHold` , |                 triggered by a key mapping or by events such as `CursorHold` , | ||||||
|                 eg: |                 eg: | ||||||
| > | > | ||||||
|     vim.api.nvim_command [[autocmd CursorHold  <buffer> lua vim.lsp.buf.document_highlight()]] |     autocmd CursorHold  <buffer> lua vim.lsp.buf.document_highlight() | ||||||
|     vim.api.nvim_command [[autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()]] |     autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight() | ||||||
|     vim.api.nvim_command [[autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()]] |     autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references() | ||||||
| < | < | ||||||
|  |  | ||||||
|                 Note: Usage of |vim.lsp.buf.document_highlight()| requires the |                 Note: Usage of |vim.lsp.buf.document_highlight()| requires the | ||||||
| @@ -1065,7 +1061,7 @@ formatting_sync({options}, {timeout_ms}) | |||||||
|                 |vim.lsp.buf_request_sync()|. Example: |                 |vim.lsp.buf_request_sync()|. Example: | ||||||
| > | > | ||||||
|  |  | ||||||
|     vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()]] |     autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync() | ||||||
| < | < | ||||||
|  |  | ||||||
|                 Parameters: ~ |                 Parameters: ~ | ||||||
| @@ -1097,9 +1093,6 @@ outgoing_calls()                                *vim.lsp.buf.outgoing_calls()* | |||||||
|                 cursor in the |quickfix| window. If the symbol can resolve to |                 cursor in the |quickfix| window. If the symbol can resolve to | ||||||
|                 multiple items, the user can pick one in the |inputlist|. |                 multiple items, the user can pick one in the |inputlist|. | ||||||
|  |  | ||||||
| prepare_rename({err}, {result})                 *vim.lsp.buf.prepare_rename()* |  | ||||||
|                 TODO: Documentation |  | ||||||
|  |  | ||||||
|                                              *vim.lsp.buf.range_code_action()* |                                              *vim.lsp.buf.range_code_action()* | ||||||
| range_code_action({context}, {start_pos}, {end_pos}) | range_code_action({context}, {start_pos}, {end_pos}) | ||||||
|                 Performs |vim.lsp.buf.code_action()| for a given range. |                 Performs |vim.lsp.buf.code_action()| for a given range. | ||||||
| @@ -1354,25 +1347,22 @@ buf_clear_references({bufnr})            *vim.lsp.util.buf_clear_references()* | |||||||
|                 Removes document highlights from a buffer. |                 Removes document highlights from a buffer. | ||||||
|  |  | ||||||
|                 Parameters: ~ |                 Parameters: ~ | ||||||
|                     {bufnr}  buffer id |                     {bufnr}  number Buffer id | ||||||
|  |  | ||||||
|                                      *vim.lsp.util.buf_highlight_references()* |                                      *vim.lsp.util.buf_highlight_references()* | ||||||
| buf_highlight_references({bufnr}, {references}, {offset_encoding}) | buf_highlight_references({bufnr}, {references}, {offset_encoding}) | ||||||
|                 Shows a list of document highlights for a certain buffer. |                 Shows a list of document highlights for a certain buffer. | ||||||
|  |  | ||||||
|                 Parameters: ~ |                 Parameters: ~ | ||||||
|                     {bufnr}            buffer id |                     {bufnr}            number Buffer id | ||||||
|                     {references}       List of `DocumentHighlight` objects to |                     {references}       table List of `DocumentHighlight` | ||||||
|                                        highlight |                                        objects to highlight | ||||||
|                     {offset_encoding}  string utf-8|utf-16|utf-32|nil defaults |                     {offset_encoding}  string One of "utf-8", "utf-16", | ||||||
|                                        to utf-16 |                                        "utf-32", or nil. Defaults to utf-16 | ||||||
|  |  | ||||||
|                 See also: ~ |                 See also: ~ | ||||||
|                     https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#documentHighlight |                     https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#documentHighlight | ||||||
|  |  | ||||||
| buf_lines()                                         *vim.lsp.util.buf_lines()* |  | ||||||
|                 TODO: Documentation |  | ||||||
|  |  | ||||||
|                                              *vim.lsp.util.character_offset()* |                                              *vim.lsp.util.character_offset()* | ||||||
| character_offset({bufnr}, {row}, {col}) | character_offset({bufnr}, {row}, {col}) | ||||||
|                 Returns the UTF-32 and UTF-16 offsets for a position in a |                 Returns the UTF-32 and UTF-16 offsets for a position in a | ||||||
| @@ -1439,12 +1429,6 @@ convert_signature_help_to_markdown_lines({signature_help}, {ft}, {triggers}) | |||||||
|                 See also: ~ |                 See also: ~ | ||||||
|                     https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp |                     https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp | ||||||
|  |  | ||||||
| create_file({change})                             *vim.lsp.util.create_file()* |  | ||||||
|                 TODO: Documentation |  | ||||||
|  |  | ||||||
| delete_file({change})                             *vim.lsp.util.delete_file()* |  | ||||||
|                 TODO: Documentation |  | ||||||
|  |  | ||||||
|                                      *vim.lsp.util.extract_completion_items()* |                                      *vim.lsp.util.extract_completion_items()* | ||||||
| extract_completion_items({result}) | extract_completion_items({result}) | ||||||
|                 Can be used to extract the completion items from a `textDocument/completion` request, which may return one of `CompletionItem[]` , `CompletionList` or null. |                 Can be used to extract the completion items from a `textDocument/completion` request, which may return one of `CompletionItem[]` , `CompletionList` or null. | ||||||
| @@ -1472,9 +1456,6 @@ get_effective_tabstop({bufnr})          *vim.lsp.util.get_effective_tabstop()* | |||||||
|                 See also: ~ |                 See also: ~ | ||||||
|                     |softtabstop| |                     |softtabstop| | ||||||
|  |  | ||||||
| get_progress_messages()                 *vim.lsp.util.get_progress_messages()* |  | ||||||
|                 TODO: Documentation |  | ||||||
|  |  | ||||||
| jump_to_location({location})                 *vim.lsp.util.jump_to_location()* | jump_to_location({location})                 *vim.lsp.util.jump_to_location()* | ||||||
|                 Jumps to a location. |                 Jumps to a location. | ||||||
|  |  | ||||||
| @@ -1775,7 +1756,10 @@ get_filename()                                    *vim.lsp.log.get_filename()* | |||||||
|                     (string) log filename |                     (string) log filename | ||||||
|  |  | ||||||
| get_level()                                          *vim.lsp.log.get_level()* | get_level()                                          *vim.lsp.log.get_level()* | ||||||
|                 TODO: Documentation |                 Gets the current log level. | ||||||
|  |  | ||||||
|  |                 Return: ~ | ||||||
|  |                     string current log level | ||||||
|  |  | ||||||
| set_format_func({handle})                      *vim.lsp.log.set_format_func()* | set_format_func({handle})                      *vim.lsp.log.set_format_func()* | ||||||
|                 Sets formatting function used to format logs |                 Sets formatting function used to format logs | ||||||
| @@ -1914,10 +1898,6 @@ compute_diff({prev_lines}, {curr_lines}, {firstline}, {lastline}, | |||||||
|                 Return: ~ |                 Return: ~ | ||||||
|                     table TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#textDocumentContentChangeEvent |                     table TextDocumentContentChangeEvent see https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#textDocumentContentChangeEvent | ||||||
|  |  | ||||||
|                                           *vim.lsp.sync.compute_line_length()* |  | ||||||
| compute_line_length({line}, {offset_encoding}) |  | ||||||
|                 TODO: Documentation |  | ||||||
|  |  | ||||||
|  |  | ||||||
| ============================================================================== | ============================================================================== | ||||||
| Lua module: vim.lsp.protocol                                    *lsp-protocol* | Lua module: vim.lsp.protocol                                    *lsp-protocol* | ||||||
|   | |||||||
| @@ -1190,9 +1190,6 @@ defer_fn({fn}, {timeout})                                     *vim.defer_fn()* | |||||||
|                 Return: ~ |                 Return: ~ | ||||||
|                     timer luv timer object |                     timer luv timer object | ||||||
|  |  | ||||||
| insert_keys({obj})                                         *vim.insert_keys()* |  | ||||||
|                 TODO: Documentation |  | ||||||
|  |  | ||||||
| inspect({object}, {options})                                   *vim.inspect()* | inspect({object}, {options})                                   *vim.inspect()* | ||||||
|                 Return a human-readable representation of the given object. |                 Return a human-readable representation of the given object. | ||||||
|  |  | ||||||
| @@ -1235,7 +1232,7 @@ on_key({fn}, {ns_id})                                           *vim.on_key()* | |||||||
|                              it removes the callback for the associated |                              it removes the callback for the associated | ||||||
|                              {ns_id} |                              {ns_id} | ||||||
|                     {ns_id}  number? Namespace ID. If nil or 0, generates and |                     {ns_id}  number? Namespace ID. If nil or 0, generates and | ||||||
|                              returns a new |nvim_create_namesapce()| id. |                              returns a new |nvim_create_namespace()| id. | ||||||
|  |  | ||||||
|                 Return: ~ |                 Return: ~ | ||||||
|                     number Namespace id associated with {fn}. Or count of all |                     number Namespace id associated with {fn}. Or count of all | ||||||
| @@ -1365,9 +1362,6 @@ is_callable({f})                                           *vim.is_callable()* | |||||||
|                 Return: ~ |                 Return: ~ | ||||||
|                     true if `f` is callable, else false |                     true if `f` is callable, else false | ||||||
|  |  | ||||||
| is_valid({opt})                                               *vim.is_valid()* |  | ||||||
|                 TODO: Documentation |  | ||||||
|  |  | ||||||
| list_extend({dst}, {src}, {start}, {finish})               *vim.list_extend()* | list_extend({dst}, {src}, {start}, {finish})               *vim.list_extend()* | ||||||
|                 Extends a list-like table with the values of another list-like |                 Extends a list-like table with the values of another list-like | ||||||
|                 table. |                 table. | ||||||
| @@ -1613,14 +1607,12 @@ validate({opt})                                               *vim.validate()* | |||||||
|  |  | ||||||
|                   vim.validate{arg1={{'foo'}, 'table'}, arg2={'foo', 'string'}} |                   vim.validate{arg1={{'foo'}, 'table'}, arg2={'foo', 'string'}} | ||||||
|                      => NOP (success) |                      => NOP (success) | ||||||
| < |  | ||||||
| > |                   vim.validate{arg1={1, 'table'}} | ||||||
|     vim.validate{arg1={1, 'table'}} |                      => error('arg1: expected table, got number') | ||||||
|        => error('arg1: expected table, got number') |  | ||||||
| < |                   vim.validate{arg1={3, function(a) return (a % 2) == 0 end, 'even number'}} | ||||||
| > |                      => error('arg1: expected even number, got 3') | ||||||
|     vim.validate{arg1={3, function(a) return (a % 2) == 0 end, 'even number'}} |  | ||||||
|        => error('arg1: expected even number, got 3') |  | ||||||
| < | < | ||||||
|  |  | ||||||
|                 Parameters: ~ |                 Parameters: ~ | ||||||
|   | |||||||
| @@ -137,12 +137,6 @@ local all_buffer_active_clients = {} | |||||||
| local uninitialized_clients = {} | local uninitialized_clients = {} | ||||||
|  |  | ||||||
| ---@private | ---@private | ||||||
| --- Invokes a function for each LSP client attached to the buffer {bufnr}. |  | ||||||
| --- |  | ||||||
| ---@param bufnr (Number) of buffer |  | ||||||
| ---@param fn (function({client}, {client_id}, {bufnr}) Function to run on |  | ||||||
| ---each client attached to that buffer. |  | ||||||
| ---@param restrict_client_ids table list of client ids on which to restrict function application. |  | ||||||
| local function for_each_buffer_client(bufnr, fn, restrict_client_ids) | local function for_each_buffer_client(bufnr, fn, restrict_client_ids) | ||||||
|   validate { |   validate { | ||||||
|     fn = { fn, 'f' }; |     fn = { fn, 'f' }; | ||||||
| @@ -327,6 +321,7 @@ do | |||||||
|   ---     timer?: uv_timer |   ---     timer?: uv_timer | ||||||
|   local state_by_client = {} |   local state_by_client = {} | ||||||
|  |  | ||||||
|  |   ---@private | ||||||
|   function changetracking.init(client, bufnr) |   function changetracking.init(client, bufnr) | ||||||
|     local state = state_by_client[client.id] |     local state = state_by_client[client.id] | ||||||
|     if not state then |     if not state then | ||||||
| @@ -348,6 +343,7 @@ do | |||||||
|     state.buffers[bufnr] = nvim_buf_get_lines(bufnr, 0, -1, true) |     state.buffers[bufnr] = nvim_buf_get_lines(bufnr, 0, -1, true) | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  |   ---@private | ||||||
|   function changetracking.reset_buf(client, bufnr) |   function changetracking.reset_buf(client, bufnr) | ||||||
|     changetracking.flush(client) |     changetracking.flush(client) | ||||||
|     local state = state_by_client[client.id] |     local state = state_by_client[client.id] | ||||||
| @@ -356,6 +352,7 @@ do | |||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  |   ---@private | ||||||
|   function changetracking.reset(client_id) |   function changetracking.reset(client_id) | ||||||
|     local state = state_by_client[client_id] |     local state = state_by_client[client_id] | ||||||
|     if state then |     if state then | ||||||
| @@ -364,6 +361,7 @@ do | |||||||
|     end |     end | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  |   ---@private | ||||||
|   function changetracking.prepare(bufnr, firstline, lastline, new_lastline) |   function changetracking.prepare(bufnr, firstline, lastline, new_lastline) | ||||||
|     local incremental_changes = function(client) |     local incremental_changes = function(client) | ||||||
|       local cached_buffers = state_by_client[client.id].buffers |       local cached_buffers = state_by_client[client.id].buffers | ||||||
| @@ -447,6 +445,7 @@ do | |||||||
|   end |   end | ||||||
|  |  | ||||||
|   --- Flushes any outstanding change notification. |   --- Flushes any outstanding change notification. | ||||||
|  |   ---@private | ||||||
|   function changetracking.flush(client) |   function changetracking.flush(client) | ||||||
|     local state = state_by_client[client.id] |     local state = state_by_client[client.id] | ||||||
|     if state then |     if state then | ||||||
| @@ -1297,6 +1296,7 @@ function lsp._vim_exit_handler() | |||||||
|  |  | ||||||
|   local poll_time = 50 |   local poll_time = 50 | ||||||
|  |  | ||||||
|  |   ---@private | ||||||
|   local function check_clients_closed() |   local function check_clients_closed() | ||||||
|     for client_id, timeout in pairs(timeouts) do |     for client_id, timeout in pairs(timeouts) do | ||||||
|       timeouts[client_id] = timeout - poll_time |       timeouts[client_id] = timeout - poll_time | ||||||
| @@ -1683,7 +1683,17 @@ function lsp.get_log_path() | |||||||
|   return log.get_filename() |   return log.get_filename() | ||||||
| end | end | ||||||
|  |  | ||||||
| --- Call {fn} for every client attached to {bufnr} | --- Invokes a function for each LSP client attached to a buffer. | ||||||
|  | --- | ||||||
|  | ---@param bufnr number Buffer number | ||||||
|  | ---@param fn function Function to run on each client attached to buffer | ||||||
|  | ---                   {bufnr}. The function takes the client, client ID, and | ||||||
|  | ---                   buffer number as arguments. Example: | ||||||
|  | ---             <pre> | ||||||
|  | ---               vim.lsp.for_each_buffer_client(0, function(client, client_id, bufnr) | ||||||
|  | ---                 print(vim.inspect(client)) | ||||||
|  | ---               end) | ||||||
|  | ---             </pre> | ||||||
| function lsp.for_each_buffer_client(bufnr, fn) | function lsp.for_each_buffer_client(bufnr, fn) | ||||||
|   return for_each_buffer_client(bufnr, fn) |   return for_each_buffer_client(bufnr, fn) | ||||||
| end | end | ||||||
|   | |||||||
| @@ -165,7 +165,7 @@ end | |||||||
| --- saved. {timeout_ms} is passed on to |vim.lsp.buf_request_sync()|. Example: | --- saved. {timeout_ms} is passed on to |vim.lsp.buf_request_sync()|. Example: | ||||||
| --- | --- | ||||||
| --- <pre> | --- <pre> | ||||||
| --- vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()]] | --- autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync() | ||||||
| --- </pre> | --- </pre> | ||||||
| --- | --- | ||||||
| ---@param options Table with valid `FormattingOptions` entries | ---@param options Table with valid `FormattingOptions` entries | ||||||
| @@ -263,6 +263,7 @@ function M.rename(new_name) | |||||||
|     request('textDocument/rename', params) |     request('textDocument/rename', params) | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  |   ---@private | ||||||
|   local function prepare_rename(err, result) |   local function prepare_rename(err, result) | ||||||
|     if err == nil and result == nil then |     if err == nil and result == nil then | ||||||
|       vim.notify('nothing to rename', vim.log.levels.INFO) |       vim.notify('nothing to rename', vim.log.levels.INFO) | ||||||
| @@ -446,9 +447,9 @@ end | |||||||
| --- by events such as `CursorHold`, eg: | --- by events such as `CursorHold`, eg: | ||||||
| --- | --- | ||||||
| --- <pre> | --- <pre> | ||||||
| --- vim.api.nvim_command [[autocmd CursorHold  <buffer> lua vim.lsp.buf.document_highlight()]] | --- autocmd CursorHold  <buffer> lua vim.lsp.buf.document_highlight() | ||||||
| --- vim.api.nvim_command [[autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()]] | --- autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight() | ||||||
| --- vim.api.nvim_command [[autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()]] | --- autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references() | ||||||
| --- </pre> | --- </pre> | ||||||
| --- | --- | ||||||
| --- Note: Usage of |vim.lsp.buf.document_highlight()| requires the following highlight groups | --- Note: Usage of |vim.lsp.buf.document_highlight()| requires the following highlight groups | ||||||
|   | |||||||
| @@ -101,6 +101,7 @@ function log.set_level(level) | |||||||
| end | end | ||||||
|  |  | ||||||
| --- Gets the current log level. | --- Gets the current log level. | ||||||
|  | ---@return string current log level | ||||||
| function log.get_level() | function log.get_level() | ||||||
|   return current_log_level |   return current_log_level | ||||||
| end | end | ||||||
|   | |||||||
| @@ -74,6 +74,7 @@ local function byte_to_utf(line, byte, offset_encoding) | |||||||
|   return utf_idx + 1 |   return utf_idx + 1 | ||||||
| end | end | ||||||
|  |  | ||||||
|  | ---@private | ||||||
| local function compute_line_length(line, offset_encoding) | local function compute_line_length(line, offset_encoding) | ||||||
|   local length |   local length | ||||||
|   local _ |   local _ | ||||||
|   | |||||||
| @@ -158,6 +158,7 @@ end | |||||||
| local function get_lines(bufnr, rows) | local function get_lines(bufnr, rows) | ||||||
|   rows = type(rows) == "table" and rows or { rows } |   rows = type(rows) == "table" and rows or { rows } | ||||||
|  |  | ||||||
|  |   ---@private | ||||||
|   local function buf_lines() |   local function buf_lines() | ||||||
|     local lines = {} |     local lines = {} | ||||||
|     for _, row in pairs(rows) do |     for _, row in pairs(rows) do | ||||||
| @@ -262,6 +263,7 @@ local function get_line_byte_from_position(bufnr, position, offset_encoding) | |||||||
| end | end | ||||||
|  |  | ||||||
| --- Process and return progress reports from lsp server | --- Process and return progress reports from lsp server | ||||||
|  | ---@private | ||||||
| function M.get_progress_messages() | function M.get_progress_messages() | ||||||
|  |  | ||||||
|   local new_messages = {} |   local new_messages = {} | ||||||
| @@ -657,7 +659,7 @@ function M.rename(old_fname, new_fname, opts) | |||||||
|   api.nvim_buf_delete(oldbuf, { force = true }) |   api.nvim_buf_delete(oldbuf, { force = true }) | ||||||
| end | end | ||||||
|  |  | ||||||
|  | ---@private | ||||||
| local function create_file(change) | local function create_file(change) | ||||||
|   local opts = change.options or {} |   local opts = change.options or {} | ||||||
|   -- from spec: Overwrite wins over `ignoreIfExists` |   -- from spec: Overwrite wins over `ignoreIfExists` | ||||||
| @@ -669,7 +671,7 @@ local function create_file(change) | |||||||
|   vim.fn.bufadd(fname) |   vim.fn.bufadd(fname) | ||||||
| end | end | ||||||
|  |  | ||||||
|  | ---@private | ||||||
| local function delete_file(change) | local function delete_file(change) | ||||||
|   local opts = change.options or {} |   local opts = change.options or {} | ||||||
|   local fname = vim.uri_to_fname(change.uri) |   local fname = vim.uri_to_fname(change.uri) | ||||||
| @@ -1418,7 +1420,7 @@ do --[[ References ]] | |||||||
|  |  | ||||||
|   --- Removes document highlights from a buffer. |   --- Removes document highlights from a buffer. | ||||||
|   --- |   --- | ||||||
|   ---@param bufnr buffer id |   ---@param bufnr number Buffer id | ||||||
|   function M.buf_clear_references(bufnr) |   function M.buf_clear_references(bufnr) | ||||||
|     validate { bufnr = {bufnr, 'n', true} } |     validate { bufnr = {bufnr, 'n', true} } | ||||||
|     api.nvim_buf_clear_namespace(bufnr, reference_ns, 0, -1) |     api.nvim_buf_clear_namespace(bufnr, reference_ns, 0, -1) | ||||||
| @@ -1426,9 +1428,9 @@ do --[[ References ]] | |||||||
|  |  | ||||||
|   --- Shows a list of document highlights for a certain buffer. |   --- Shows a list of document highlights for a certain buffer. | ||||||
|   --- |   --- | ||||||
|   ---@param bufnr buffer id |   ---@param bufnr number Buffer id | ||||||
|   ---@param references List of `DocumentHighlight` objects to highlight |   ---@param references table List of `DocumentHighlight` objects to highlight | ||||||
|   ---@param offset_encoding string utf-8|utf-16|utf-32|nil defaults to utf-16 |   ---@param offset_encoding string One of "utf-8", "utf-16", "utf-32", or nil. Defaults to utf-16 | ||||||
|   ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#documentHighlight |   ---@see https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#documentHighlight | ||||||
|   function M.buf_highlight_references(bufnr, references, offset_encoding) |   function M.buf_highlight_references(bufnr, references, offset_encoding) | ||||||
|     validate { bufnr = {bufnr, 'n', true} } |     validate { bufnr = {bufnr, 'n', true} } | ||||||
|   | |||||||
| @@ -559,6 +559,7 @@ do | |||||||
|     return type(val) == t or (t == 'callable' and vim.is_callable(val)) |     return type(val) == t or (t == 'callable' and vim.is_callable(val)) | ||||||
|   end |   end | ||||||
|  |  | ||||||
|  |   ---@private | ||||||
|   local function is_valid(opt) |   local function is_valid(opt) | ||||||
|     if type(opt) ~= 'table' then |     if type(opt) ~= 'table' then | ||||||
|       return false, string.format('opt: expected table, got %s', type(opt)) |       return false, string.format('opt: expected table, got %s', type(opt)) | ||||||
|   | |||||||
| @@ -454,7 +454,7 @@ local on_key_cbs = {} | |||||||
| ---                   On each key press, Nvim passes the key char to fn(). |i_CTRL-V| | ---                   On each key press, Nvim passes the key char to fn(). |i_CTRL-V| | ||||||
| ---                   If {fn} is nil, it removes the callback for the associated {ns_id} | ---                   If {fn} is nil, it removes the callback for the associated {ns_id} | ||||||
| ---@param ns_id number? Namespace ID. If nil or 0, generates and returns a new | ---@param ns_id number? Namespace ID. If nil or 0, generates and returns a new | ||||||
| ---                    |nvim_create_namesapce()| id. | ---                    |nvim_create_namespace()| id. | ||||||
| --- | --- | ||||||
| ---@return number Namespace id associated with {fn}. Or count of all callbacks | ---@return number Namespace id associated with {fn}. Or count of all callbacks | ||||||
| ---if on_key() is called without arguments. | ---if on_key() is called without arguments. | ||||||
| @@ -580,6 +580,7 @@ function vim._expand_pat(pat, env) | |||||||
|   end |   end | ||||||
|  |  | ||||||
|   local keys = {} |   local keys = {} | ||||||
|  |   ---@private | ||||||
|   local function insert_keys(obj) |   local function insert_keys(obj) | ||||||
|     for k,_ in pairs(obj) do |     for k,_ in pairs(obj) do | ||||||
|       if type(k) == "string" and string.sub(k,1,string.len(match_part)) == match_part then |       if type(k) == "string" and string.sub(k,1,string.len(match_part)) == match_part then | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Björn Linse
					Björn Linse