mirror of https://github.com/neovim/neovim.git
Compare commits
4 Commits
6bb7cb9d89
...
09b3abc4c5
Author | SHA1 | Date |
---|---|---|
Will Hopkins | 09b3abc4c5 | |
Maria José Solano | efb44e0cad | |
zeertzjq | e948d7feba | |
Will Hopkins | 313bf85c22 |
|
@ -3014,7 +3014,7 @@ getscriptinfo([{opts}]) *getscriptinfo()*
|
|||
|
||||
Examples: >vim
|
||||
echo getscriptinfo({'name': 'myscript'})
|
||||
echo getscriptinfo({'sid': 15}).variables
|
||||
echo getscriptinfo({'sid': 15})[0].variables
|
||||
<
|
||||
|
||||
gettabinfo([{tabnr}]) *gettabinfo()*
|
||||
|
|
|
@ -124,7 +124,7 @@ error('Cannot require a meta file')
|
|||
--- @field commalist boolean
|
||||
--- @field flaglist boolean
|
||||
--- @field was_set boolean
|
||||
--- @field last_set_id integer
|
||||
--- @field last_set_sid integer
|
||||
--- @field last_set_linenr integer
|
||||
--- @field last_set_chan integer
|
||||
--- @field type 'string'|'boolean'|'number'
|
||||
|
|
|
@ -127,3 +127,11 @@
|
|||
--- @field skipcol integer
|
||||
--- @field topfill integer
|
||||
--- @field topline integer
|
||||
|
||||
--- @class vim.fn.getscriptinfo.ret
|
||||
--- @field autoload false
|
||||
--- @field functions? string[]
|
||||
--- @field name string
|
||||
--- @field sid string
|
||||
--- @field variables? table<string, any>
|
||||
--- @field version 1
|
||||
|
|
|
@ -3628,11 +3628,11 @@ function vim.fn.getregtype(regname) end
|
|||
---
|
||||
--- Examples: >vim
|
||||
--- echo getscriptinfo({'name': 'myscript'})
|
||||
--- echo getscriptinfo({'sid': 15}).variables
|
||||
--- echo getscriptinfo({'sid': 15})[0].variables
|
||||
--- <
|
||||
---
|
||||
--- @param opts? table
|
||||
--- @return any
|
||||
--- @return vim.fn.getscriptinfo.ret[]
|
||||
function vim.fn.getscriptinfo(opts) end
|
||||
|
||||
--- If {tabnr} is not specified, then information about all the
|
||||
|
|
|
@ -310,6 +310,7 @@ local function is_empty_or_default(bufnr, option)
|
|||
end
|
||||
|
||||
local info = api.nvim_get_option_info2(option, { buf = bufnr })
|
||||
---@param e vim.fn.getscriptinfo.ret
|
||||
local scriptinfo = vim.tbl_filter(function(e)
|
||||
return e.sid == info.last_set_sid
|
||||
end, vim.fn.getscriptinfo())
|
||||
|
@ -515,7 +516,7 @@ local function buf_attach(bufnr)
|
|||
textDocument = {
|
||||
uri = uri,
|
||||
},
|
||||
reason = protocol.TextDocumentSaveReason.Manual,
|
||||
reason = protocol.TextDocumentSaveReason.Manual, ---@type integer
|
||||
}
|
||||
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'willSave') then
|
||||
client.notify(ms.textDocument_willSave, params)
|
||||
|
@ -899,7 +900,7 @@ end
|
|||
--- a `client_id:result` map.
|
||||
---@return function cancel Function that cancels all requests.
|
||||
function lsp.buf_request_all(bufnr, method, params, handler)
|
||||
local results = {} --- @type table<integer,{error:string, result:any}>
|
||||
local results = {} --- @type table<integer,{error:lsp.ResponseError, result:any}>
|
||||
local result_count = 0
|
||||
local expected_result_count = 0
|
||||
|
||||
|
@ -940,7 +941,7 @@ end
|
|||
---@return table<integer, {err: lsp.ResponseError, result: any}>? result Map of client_id:request_result.
|
||||
---@return string? err On timeout, cancel, or error, `err` is a string describing the failure reason, and `result` is nil.
|
||||
function lsp.buf_request_sync(bufnr, method, params, timeout_ms)
|
||||
local request_results
|
||||
local request_results ---@type table
|
||||
|
||||
local cancel = lsp.buf_request_all(bufnr, method, params, function(it)
|
||||
request_results = it
|
||||
|
|
|
@ -327,7 +327,7 @@ function M.get_captures_at_cursor(winnr)
|
|||
end
|
||||
|
||||
--- Optional keyword arguments:
|
||||
--- @class vim.treesitter.get_node.Opts
|
||||
--- @class vim.treesitter.get_node.Opts : vim.treesitter.LanguageTree.tree_for_range.Opts
|
||||
--- @inlinedoc
|
||||
---
|
||||
--- Buffer number (nil or 0 for current buffer)
|
||||
|
|
|
@ -22,6 +22,12 @@ typedef struct {
|
|||
LuaRef _on_spell_nav;
|
||||
} Dict(set_decoration_provider);
|
||||
|
||||
typedef struct {
|
||||
OptionalKeys is_set__win_fold_;
|
||||
Boolean recursive;
|
||||
Boolean open;
|
||||
} Dict(win_fold);
|
||||
|
||||
typedef struct {
|
||||
OptionalKeys is_set__set_extmark_;
|
||||
Integer id;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "nvim/eval/typval.h"
|
||||
#include "nvim/eval/vars.h"
|
||||
#include "nvim/ex_eval.h"
|
||||
#include "nvim/fold.h"
|
||||
#include "nvim/garray_defs.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/highlight_group.h"
|
||||
|
|
|
@ -13,8 +13,10 @@
|
|||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/cursor.h"
|
||||
#include "nvim/drawscreen.h"
|
||||
#include "nvim/eval/typval.h"
|
||||
#include "nvim/eval/window.h"
|
||||
#include "nvim/ex_docmd.h"
|
||||
#include "nvim/fold.h"
|
||||
#include "nvim/gettext_defs.h"
|
||||
#include "nvim/globals.h"
|
||||
#include "nvim/lua/executor.h"
|
||||
|
@ -30,6 +32,46 @@
|
|||
# include "api/window.c.generated.h"
|
||||
#endif
|
||||
|
||||
/// Opens or closes the fold at or around the specified line in a window.
|
||||
///
|
||||
/// @param window Window handle, or 0 for current window
|
||||
/// @param lnum Line number
|
||||
/// @param opts Dictionary
|
||||
/// - "open": Open or close folds
|
||||
/// - "recurse": Recurse over all folds within the specified fold, like |zC| / |zO|
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_win_fold(Window window, Integer lnum, Dict(win_fold) *opts, Error *err)
|
||||
FUNC_API_SINCE(12)
|
||||
{
|
||||
bool recurse = HAS_KEY(opts, win_fold, recursive) && opts->recursive;
|
||||
bool open = HAS_KEY(opts, win_fold, open) && opts->open;
|
||||
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
if (!win) {
|
||||
return;
|
||||
}
|
||||
if (lnum > INT32_MAX || lnum < 0) {
|
||||
api_set_error(err, kErrorTypeValidation, "Line value outside range");
|
||||
return;
|
||||
}
|
||||
|
||||
foldinfo_T fi = fold_info(win, (linenr_T)lnum);
|
||||
|
||||
pos_T start;
|
||||
start.lnum = fi.fi_lnum;
|
||||
start.col = 0;
|
||||
start.coladd = 0;
|
||||
|
||||
pos_T end;
|
||||
end.lnum = fi.fi_lnum + fi.fi_lines;
|
||||
end.col = 0;
|
||||
end.coladd = 0;
|
||||
|
||||
try_start();
|
||||
opFoldRange(start, end, open, recurse, false);
|
||||
try_end(err);
|
||||
}
|
||||
|
||||
/// Gets the current buffer in a window
|
||||
///
|
||||
/// @param window Window handle, or 0 for current window
|
||||
|
|
|
@ -4470,11 +4470,12 @@ M.funcs = {
|
|||
|
||||
Examples: >vim
|
||||
echo getscriptinfo({'name': 'myscript'})
|
||||
echo getscriptinfo({'sid': 15}).variables
|
||||
echo getscriptinfo({'sid': 15})[0].variables
|
||||
<
|
||||
]=],
|
||||
name = 'getscriptinfo',
|
||||
params = { { 'opts', 'table' } },
|
||||
returns = 'vim.fn.getscriptinfo.ret[]',
|
||||
signature = 'getscriptinfo([{opts}])',
|
||||
},
|
||||
gettabinfo = {
|
||||
|
|
Loading…
Reference in New Issue