mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
docs: update api
This commit is contained in:
parent
75996a2cdd
commit
18bf216993
@ -529,14 +529,6 @@ nvim__id_float({flt}) *nvim__id_float()*
|
||||
nvim__inspect_cell({grid}, {row}, {col}) *nvim__inspect_cell()*
|
||||
TODO: Documentation
|
||||
|
||||
*nvim__put_attr()*
|
||||
nvim__put_attr({id}, {start_row}, {start_col}, {end_row}, {end_col})
|
||||
Set attrs in nvim__buf_set_lua_hl callbacks
|
||||
|
||||
TODO(bfredl): This is rather pedestrian. The final interface
|
||||
should probably be derived from a reformed bufhl/virttext
|
||||
interface with full support for multi-line ranges etc
|
||||
|
||||
nvim__screenshot({path}) *nvim__screenshot()*
|
||||
TODO: Documentation
|
||||
|
||||
@ -1480,6 +1472,53 @@ nvim_set_current_win({window}) *nvim_set_current_win()*
|
||||
Parameters: ~
|
||||
{window} Window handle
|
||||
|
||||
*nvim_set_decoration_provider()*
|
||||
nvim_set_decoration_provider({ns_id}, {opts})
|
||||
Set or change decoration provider for a namespace
|
||||
|
||||
This is a very general purpose interface for having lua
|
||||
callbacks being triggered during the redraw code.
|
||||
|
||||
The expected usage is to set extmarks for the currently
|
||||
redrawn buffer. |nvim_buf_set_extmark| can be called to add
|
||||
marks on a per-window or per-lines basis. Use the `ephemeral`
|
||||
key to only use the mark for the current screen redraw (the
|
||||
callback will be called again for the next redraw ).
|
||||
|
||||
Note: this function should not be called often. Rather, the
|
||||
callbacks themselves can be used to throttle unneeded
|
||||
callbacks. the `on_start` callback can return `false` to
|
||||
disable the provider until the next redraw. Similarily, return
|
||||
`false` in `on_win` will skip the `on_lines` calls for that
|
||||
window (but any extmarks set in `on_win` will still be used).
|
||||
A plugin managing multiple sources of decorations should
|
||||
ideally only set one provider, and merge the sources
|
||||
internally. You can use multiple `ns_id` for the extmarks
|
||||
set/modified inside the callback anyway.
|
||||
|
||||
Note: doing anything other than setting extmarks is considered
|
||||
experimental. Doing things like changing options are not
|
||||
expliticly forbidden, but is likely to have unexpected
|
||||
consequences (such as 100% CPU consumption). doing
|
||||
`vim.rpcnotify` should be OK, but `vim.rpcrequest` is quite
|
||||
dubious for the moment.
|
||||
|
||||
Parameters: ~
|
||||
{ns_id} Namespace id from |nvim_create_namespace()|
|
||||
{opts} Callbacks invoked during redraw:
|
||||
• on_start: called first on each screen redraw
|
||||
["start", tick]
|
||||
• on_buf: called for each buffer being redrawn
|
||||
(before window callbacks) ["buf", bufnr, tick]
|
||||
• on_win: called when starting to redraw a
|
||||
specific window. ["win", winid, bufnr, topline,
|
||||
botline_guess]
|
||||
• on_line: called for each buffer line being
|
||||
redrawn. (The interation with fold lines is
|
||||
subject to change) ["win", winid, bufnr, row]
|
||||
• on_end: called at the end of a redraw cycle
|
||||
["end", tick]
|
||||
|
||||
nvim_set_keymap({mode}, {lhs}, {rhs}, {opts}) *nvim_set_keymap()*
|
||||
Sets a global |mapping| for the given mode.
|
||||
|
||||
@ -1575,18 +1614,6 @@ to check whether a buffer is loaded.
|
||||
nvim__buf_redraw_range({buffer}, {first}, {last})
|
||||
TODO: Documentation
|
||||
|
||||
nvim__buf_set_luahl({buffer}, {opts}) *nvim__buf_set_luahl()*
|
||||
Unstabilized interface for defining syntax hl in lua.
|
||||
|
||||
This is not yet safe for general use, lua callbacks will need
|
||||
to be restricted, like textlock and probably other stuff.
|
||||
|
||||
The API on_line/nvim__put_attr is quite raw and not intended
|
||||
to be the final shape. Ideally this should operate on chunks
|
||||
larger than a single line to reduce interpreter overhead, and
|
||||
generate annotation objects (bufhl/virttext) on the fly but
|
||||
using the same representation.
|
||||
|
||||
nvim__buf_stats({buffer}) *nvim__buf_stats()*
|
||||
TODO: Documentation
|
||||
|
||||
@ -1690,6 +1717,29 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
|
||||
|nvim_buf_detach()|
|
||||
|api-buffer-updates-lua|
|
||||
|
||||
nvim_buf_call({buffer}, {fun}) *nvim_buf_call()*
|
||||
call a function with buffer as temporary current buffer
|
||||
|
||||
This temporarily switches current buffer to "buffer". If the
|
||||
current window already shows "buffer", the window is not
|
||||
switched If a window inside the current tabpage (including a
|
||||
float) already shows the buffer One of these windows will be
|
||||
set as current window temporarily. Otherwise a temporary
|
||||
scratch window (calleed the "autocmd window" for historical
|
||||
reasons) will be used.
|
||||
|
||||
This is useful e.g. to call vimL functions that only work with
|
||||
the current buffer/window currently, like |termopen()|.
|
||||
|
||||
Parameters: ~
|
||||
{buffer} Buffer handle, or 0 for current buffer
|
||||
{fun} Function to call inside the buffer (currently
|
||||
lua callable only)
|
||||
|
||||
Return: ~
|
||||
Return value of function. NB: will deepcopy lua values
|
||||
currently, use upvalues to send lua references in and out.
|
||||
|
||||
*nvim_buf_clear_namespace()*
|
||||
nvim_buf_clear_namespace({buffer}, {ns_id}, {line_start}, {line_end})
|
||||
Clears namespaced objects (highlights, extmarks, virtual text)
|
||||
@ -1986,6 +2036,11 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts})
|
||||
• hl_group : name of the highlight group used to
|
||||
highlight this mark.
|
||||
• virt_text : virtual text to link to this mark.
|
||||
• ephemeral : for use with
|
||||
|nvim_set_decoration_provider| callbacks. The
|
||||
mark will only be used for the current redraw
|
||||
cycle, and not be permantently stored in the
|
||||
buffer.
|
||||
|
||||
Return: ~
|
||||
Id of the created/updated extmark
|
||||
|
@ -792,6 +792,20 @@ outgoing_calls() *vim.lsp.buf.outgoing_calls()*
|
||||
cursor in the |quickfix| window. If the symbol can resolve to
|
||||
multiple items, the user can pick one in the |inputlist|.
|
||||
|
||||
*vim.lsp.buf.range_code_action()*
|
||||
range_code_action({context}, {start_pos}, {end_pos})
|
||||
Performs |vim.lsp.buf.code_action()| for a given range.
|
||||
|
||||
Parameters: ~
|
||||
{context} (table, optional) Valid `CodeActionContext`
|
||||
object
|
||||
{start_pos} ({number, number}, optional) mark-indexed
|
||||
position. Defaults to the start of the last
|
||||
visual selection.
|
||||
{end_pos} ({number, number}, optional) mark-indexed
|
||||
position. Defaults to the end of the last
|
||||
visual selection.
|
||||
|
||||
*vim.lsp.buf.range_formatting()*
|
||||
range_formatting({options}, {start_pos}, {end_pos})
|
||||
Formats a given range.
|
||||
@ -1285,6 +1299,23 @@ make_formatting_params({options})
|
||||
See also: ~
|
||||
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting
|
||||
|
||||
*vim.lsp.util.make_given_range_params()*
|
||||
make_given_range_params({start_pos}, {end_pos})
|
||||
Using the given range in the current buffer, creates an object
|
||||
that is similar to |vim.lsp.util.make_range_params()|.
|
||||
|
||||
Parameters: ~
|
||||
{start_pos} ({number, number}, optional) mark-indexed
|
||||
position. Defaults to the start of the last
|
||||
visual selection.
|
||||
{end_pos} ({number, number}, optional) mark-indexed
|
||||
position. Defaults to the end of the last
|
||||
visual selection.
|
||||
|
||||
Return: ~
|
||||
{ textDocument = { uri = `current_file_uri` }, range = {
|
||||
start = `start_position` , end = `end_position` } }
|
||||
|
||||
make_position_params() *vim.lsp.util.make_position_params()*
|
||||
Creates a `TextDocumentPositionParams` object for the current
|
||||
buffer and cursor position.
|
||||
|
@ -1031,6 +1031,9 @@ is_callable({f}) *vim.is_callable()*
|
||||
Return: ~
|
||||
true if `f` is callable, else false
|
||||
|
||||
is_valid({opt}) *vim.is_valid()*
|
||||
TODO: Documentation
|
||||
|
||||
list_extend({dst}, {src}, {start}, {finish}) *vim.list_extend()*
|
||||
Extends a list-like table with the values of another list-like
|
||||
table.
|
||||
@ -1286,7 +1289,9 @@ validate({opt}) *vim.validate()*
|
||||
• arg_value: argument value
|
||||
• fn: any function accepting one argument,
|
||||
returns true if and only if the argument is
|
||||
valid
|
||||
valid. Can optionally return an additional
|
||||
informative error message as the second
|
||||
returned value.
|
||||
• msg: (optional) error string if validation
|
||||
fails
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user