diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 0d85d6b539..fe69d9076f 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -993,7 +993,7 @@ nvim_get_option_info({name}) *nvim_get_option_info()* Resulting dictionary has keys: • name: Name of the option (like 'filetype') • shortname: Shortened name of the option (like 'ft') - • type: type of option ("string", "integer" or "boolean") + • type: type of option ("string", "number" or "boolean") • default: The default value for the option • was_set: Whether the option was set. • last_set_sid: Last set script id (if any) @@ -1299,6 +1299,17 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()* an external top-level window. Currently accepts no other positioning configuration together with this. + • `zindex`: Stacking order. floats with higher`zindex`go on top on floats with lower indices. Must + be larger than zero. The following screen + elements have hard-coded z-indices: + • 100: insert completion popupmenu + • 200: message scrollback + • 250: cmdline completion popupmenu (when + wildoptions+=pum) The default value for + floats are 50. In general, values below 100 + are recommended, unless there is a good + reason to overshadow builtin elements. + • `style`: Configure the appearance of the window. Currently only takes one non-empty value: • "minimal" Nvim will display the window with @@ -1705,6 +1716,12 @@ nvim_set_hl({ns_id}, {name}, {val}) *nvim_set_hl()* |nvim_get_hl_by_name|. in addition the following keys are also recognized: `default` : don't override existing definition, like `hi default` + `ctermfg` : sets foreground of cterm color + `ctermbg` : sets background of cterm color + `cterm` : cterm attribute map. sets attributed + for cterm colors. similer to `hi cterm` Note: by + default cterm attributes are same as attributes + of gui color nvim_set_keymap({mode}, {lhs}, {rhs}, {opts}) *nvim_set_keymap()* Sets a global |mapping| for the given mode. @@ -2269,7 +2286,12 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts}) • "overlay": display over the specified column, without shifting the underlying text. + • "right_align": display right aligned in the + window. + • virt_text_win_col : position the virtual text + at a fixed window column (starting from the + first text column) • virt_text_hide : hide the virtual text when the background text is selected or hidden due to horizontal scroll 'nowrap' diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 5c2ee568c5..c52012ac00 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -619,15 +619,15 @@ buf_request_sync({bufnr}, {method}, {params}, {timeout_ms}) Calls |vim.lsp.buf_request_all()| but blocks Nvim while awaiting the result. Parameters are the same as |vim.lsp.buf_request()| but the return result is different. - Wait maximum of {timeout_ms} (default 100) ms. + Wait maximum of {timeout_ms} (default 1000) ms. Parameters: ~ {bufnr} (number) Buffer handle, or 0 for current. {method} (string) LSP method name {params} (optional, table) Parameters to send to the server - {timeout_ms} (optional, number, default=100) Maximum time - in milliseconds to wait for a result. + {timeout_ms} (optional, number, default=1000) Maximum + time in milliseconds to wait for a result. Return: ~ Map of client_id:request_result. On timeout, cancel or @@ -651,6 +651,14 @@ client() *vim.lsp.client* {status} is `true` , the function returns {request_id} as the second result. You can use this with `client.cancel_request(request_id)` to cancel the request. + • request_sync(method, params, timeout_ms, bufnr) Sends a + request to the server and synchronously waits for the + response. This is a wrapper around {client.request} + Returns: { err=err, result=result }, a dictionary, where + `err` and `result` come from the |lsp-handler|. On + timeout, cancel or error, returns `(nil, err)` where `err` + is a string describing the failure reason. If the request + was unsuccessful returns `nil` . • notify(method, params) Sends a notification to an LSP server. Returns: a boolean to indicate if the notification was successful. If it is false, then it will always be @@ -939,6 +947,9 @@ add_workspace_folder({workspace_folder}) not provided, the user will be prompted for a path using |input()|. +call_hierarchy({method}) *vim.lsp.buf.call_hierarchy()* + TODO: Documentation + clear_references() *vim.lsp.buf.clear_references()* Removes document highlights from current buffer. @@ -1017,6 +1028,32 @@ formatting({options}) *vim.lsp.buf.formatting()* See also: ~ https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting + *vim.lsp.buf.formatting_seq_sync()* +formatting_seq_sync({options}, {timeout_ms}, {order}) + Formats the current buffer by sequentially requesting + formatting from attached clients. + + Useful when multiple clients with formatting capability are + attached. + + Since it's synchronous, can be used for running on save, to + make sure buffer is formatted prior to being saved. + {timeout_ms} is passed on to the |vim.lsp.client| `request_sync` method. Example: > + + vim.api.nvim_command[[autocmd BufWritePre lua vim.lsp.buf.formatting_seq_sync()]] +< + + Parameters: ~ + {options} (optional, table) `FormattingOptions` + entries + {timeout_ms} (optional, number) Request timeout + {order} (optional, table) List of client names. + Formatting is requested from clients in the + following order: first all clients that are + not in the `order` list, then the remaining + clients in the order as they occur in the + `order` list. + *vim.lsp.buf.formatting_sync()* formatting_sync({options}, {timeout_ms}) Performs |vim.lsp.buf.formatting()| synchronously. @@ -1033,6 +1070,9 @@ formatting_sync({options}, {timeout_ms}) {options} Table with valid `FormattingOptions` entries {timeout_ms} (number) Request timeout + See also: ~ + |vim.lsp.buf.formatting_seq_sync| + hover() *vim.lsp.buf.hover()* Displays hover information about the symbol under the cursor in a floating window. Calling the function twice will jump @@ -1650,12 +1690,15 @@ convert_input_to_markdown_lines({input}, {contents}) https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover *vim.lsp.util.convert_signature_help_to_markdown_lines()* -convert_signature_help_to_markdown_lines({signature_help}) +convert_signature_help_to_markdown_lines({signature_help}, {ft}) Converts `textDocument/SignatureHelp` response to markdown lines. Parameters: ~ {signature_help} Response of `textDocument/SignatureHelp` + {ft} optional filetype that will be use as + the `lang` for the label markdown code + block Return: ~ list of lines of converted markdown. @@ -1683,65 +1726,6 @@ extract_completion_items({result}) See also: ~ https://microsoft.github.io/language-server-protocol/specification#textDocument_completion - *vim.lsp.util.fancy_floating_markdown()* -fancy_floating_markdown({contents}, {opts}) - Converts markdown into syntax highlighted regions by stripping - the code blocks and converting them into highlighted code. - This will by default insert a blank line separator after those - code block regions to improve readability. The result is shown - in a floating preview. - - Parameters: ~ - {contents} table of lines to show in window - {opts} dictionary with optional fields - • height of floating window - • width of floating window - • wrap_at character to wrap at for computing - height - • max_width maximal width of floating window - • max_height maximal height of floating window - • pad_left number of columns to pad contents - at left - • pad_right number of columns to pad contents - at right - • pad_top number of lines to pad contents at - top - • pad_bottom number of lines to pad contents - at bottom - • separator insert separator after code block - - Return: ~ - width,height size of float - -focusable_float({unique_name}, {fn}) *vim.lsp.util.focusable_float()* - Parameters: ~ - {unique_name} (string) Window variable - {fn} (function) should return create a new - window and return a tuple of - ({focusable_buffer_id}, {window_id}). if - {focusable_buffer_id} is a valid buffer id, - the newly created window will be the new - focus associated with the current buffer - via the tag `unique_name` . - - Return: ~ - (pbufnr, pwinnr) if `fn()` has created a new window; nil - otherwise - - *vim.lsp.util.focusable_preview()* -focusable_preview({unique_name}, {fn}) - Focuses/unfocuses the floating preview window associated with - the current buffer via the window variable `unique_name` . If - no such preview window exists, makes a new one. - - Parameters: ~ - {unique_name} (string) Window variable - {fn} (function) The return values of this - function will be passed directly to - |vim.lsp.util.open_floating_preview()|, in - the case that a new floating window should - be created - get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()* Returns visual width of tabstop. @@ -1755,6 +1739,14 @@ get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()* See also: ~ |softtabstop| +get_line({uri}, {row}) *vim.lsp.util.get_line()* + Parameters: ~ + {uri} string uri of the resource to get the line from + {row} number zero-indexed line number + + Return: ~ + string the line at row in filename + get_progress_messages() *vim.lsp.util.get_progress_messages()* TODO: Documentation @@ -1897,7 +1889,7 @@ parse_snippet({input}) *vim.lsp.util.parse_snippet()* Return: ~ (string) parsed snippet -preview_location({location}) *vim.lsp.util.preview_location()* +preview_location({location}, {opts}) *vim.lsp.util.preview_location()* Previews a location in a floating window behavior depends on type of location: @@ -1946,6 +1938,41 @@ set_qflist({items}) *vim.lsp.util.set_qflist()* Parameters: ~ {items} (table) list of items + *vim.lsp.util.stylize_markdown()* +stylize_markdown({bufnr}, {contents}, {opts}) + Converts markdown into syntax highlighted regions by stripping + the code blocks and converting them into highlighted code. + This will by default insert a blank line separator after those + code block regions to improve readability. + + This method configures the given buffer and returns the lines + to set. + + If you want to open a popup with fancy markdown, use + `open_floating_preview` instead + + Parameters: ~ + {contents} table of lines to show in window + {opts} dictionary with optional fields + • height of floating window + • width of floating window + • wrap_at character to wrap at for computing + height + • max_width maximal width of floating window + • max_height maximal height of floating window + • pad_left number of columns to pad contents + at left + • pad_right number of columns to pad contents + at right + • pad_top number of lines to pad contents at + top + • pad_bottom number of lines to pad contents + at bottom + • separator insert separator after code block + + Return: ~ + width,height size of float + symbols_to_items({symbols}, {bufnr}) *vim.lsp.util.symbols_to_items()* Converts symbols to quickfix list items. diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index c3893d05c0..03056a603f 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1118,6 +1118,23 @@ vim.wo *vim.wo* ============================================================================== Lua module: vim *lua-vim* +defer_fn({fn}, {timeout}) *vim.defer_fn()* + Defers calling `fn` until `timeout` ms passes. + + Use to do a one-shot timer that calls `fn` Note: The {fn} is |schedule_wrap|ped automatically, so API + functions are safe to call. + + Parameters: ~ + {fn} Callback to call once `timeout` expires + {timeout} Number of milliseconds to wait before calling + `fn` + + Return: ~ + timer luv timer object + +insert_keys({obj}) *vim.insert_keys()* + TODO: Documentation + inspect({object}, {options}) *vim.inspect()* Return a human-readable representation of the given object. @@ -1125,9 +1142,19 @@ inspect({object}, {options}) *vim.inspect()* https://github.com/kikito/inspect.lua https://github.com/mpeterv/vinspect -make_meta_accessor({get}, {set}, {del}) *vim.make_meta_accessor()* +make_dict_accessor({scope}) *vim.make_dict_accessor()* TODO: Documentation +notify({msg}, {log_level}, {_opts}) *vim.notify()* + Notification provider without a runtime, writes to :Messages + + Parameters: ~ + {msg} Content of the notification to show to the + user + {log_level} Optional log level + {opts} Dictionary with optional options (timeout, + etc) + paste({lines}, {phase}) *vim.paste()* Paste handler, invoked by |nvim_paste()| when a conforming UI (such as the |TUI|) pastes text into the editor. @@ -1160,6 +1187,53 @@ paste({lines}, {phase}) *vim.paste()* See also: ~ |paste| +region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive}) *vim.region()* + Get a table of lines with start, end columns for a region + marked by two points + + Parameters: ~ + {bufnr} number of buffer + {pos1} (line, column) tuple marking beginning of + region + {pos2} (line, column) tuple marking end of region + {regtype} type of selection (:help setreg) + {inclusive} boolean indicating whether the selection is + end-inclusive + + Return: ~ + region lua table of the form {linenr = {startcol,endcol}} + + *vim.register_keystroke_callback()* +register_keystroke_callback({fn}, {ns_id}) + Register a lua {fn} with an {id} to be run after every + keystroke. + + If {fn} is nil, it removes the callback for the associated + {ns_id} + Note: + {fn} will not be cleared from |nvim_buf_clear_namespace()| + + Note: + {fn} will receive the keystrokes after mappings have been + evaluated + + Parameters: ~ + {fn} function: Function to call. It should take one + argument, which is a string. The string will contain + the literal keys typed. See |i_CTRL-V| + {ns_id} number? Namespace ID. If not passed or 0, will + generate and return a new namespace ID from + |nvim_create_namesapce()| + + Return: ~ + number Namespace ID associated with {fn} + + Note: + {fn} will be automatically removed if an error occurs + while calling. This is to prevent the annoying situation + of every keystroke erroring while trying to remove a + broken callback. + schedule_wrap({cb}) *vim.schedule_wrap()* Defers callback `cb` until the Nvim API is safe to call.