From c43c745a14dced87a23227d7be4f1c33d4455193 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 9 Aug 2023 11:06:13 +0200 Subject: fix(lua): improve annotations for stricter luals diagnostics (#24609) Problem: luals returns stricter diagnostics with bundled luarc.json Solution: Improve some function and type annotations: * use recognized uv.* types * disable diagnostic for global `vim` in shared.lua * docs: don't start comment lines with taglink (otherwise LuaLS will interpret it as a type) * add type alias for lpeg pattern * fix return annotation for `vim.secure.trust` * rename local Range object in vim.version (shadows `Range` in vim.treesitter) * fix some "missing fields" warnings * add missing required fields for test functions in eval.lua * rename lsp meta files for consistency --- runtime/doc/builtin.txt | 8 ++++++++ runtime/doc/diagnostic.txt | 2 +- runtime/doc/lsp.txt | 3 ++- runtime/doc/lua.txt | 9 ++++----- runtime/doc/testing.txt | 6 +----- 5 files changed, 16 insertions(+), 12 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 99ea2920f7..0c239b223d 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1857,6 +1857,7 @@ foldtextresult({lnum}) *foldtextresult()* line, "'m" mark m, etc. Useful when exporting folded text, e.g., to HTML. + fullcommand({name}) *fullcommand()* Get the full command name from a short abbreviated command name; see |20.2| for details on command abbreviations. @@ -7993,6 +7994,13 @@ termopen({cmd} [, {opts}]) *termopen()* except $TERM is set to "xterm-256color". Full behavior is described in |terminal|. +test_garbagecollect_now() *test_garbagecollect_now()* + Like |garbagecollect()|, but executed right away. This must + only be called directly to avoid any structure to exist + internally, and |v:testing| must have been set before calling + any function. + + timer_info([{id}]) *timer_info()* Return a list with information about timers. When {id} is given only information about this timer is diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index 4b2b5e5f9a..d95e0d8333 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -459,7 +459,7 @@ fromqflist({list}) *vim.diagnostic.fromqflist()* Convert a list of quickfix items to a list of diagnostics. Parameters: ~ - • {list} (table) A list of quickfix items from |getqflist()| or + • {list} table[] List of quickfix items from |getqflist()| or |getloclist()|. Return: ~ diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 2140284503..4c0ad1e035 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -2127,7 +2127,8 @@ request({method}, {params}, {callback}, {notify_reply_callback}) • {method} (string) The invoked LSP method • {params} (table|nil) Parameters for the invoked LSP method - • {callback} fun(err: lsp.ResponseError | nil, result: any) Callback to invoke + • {callback} fun(err: lsp.ResponseError | nil, result: + any) Callback to invoke • {notify_reply_callback} (function|nil) Callback to invoke as soon as a request is no longer pending diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index c3e540a4ae..fb92ad411e 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2073,7 +2073,7 @@ vim.spairs({t}) *vim.spairs()* • {t} (table) Dict-like table Return: ~ - iterator over sorted keys and their values + (function) iterator over sorted keys and their values See also: ~ • Based on https://github.com/premake/premake-core/blob/master/src/base/table.lua @@ -3007,10 +3007,9 @@ vim.secure.trust({opts}) *vim.secure.trust()* • bufnr (number|nil): Buffer number to update. Mutually exclusive with {path}. - Return: ~ - (boolean, string) success, msg: - • true and full path of target file if operation was successful - • false and error message on failure + Return (multiple): ~ + (boolean) success true if operation was successful + (string) msg full path if operation was successful, else error message ============================================================================== diff --git a/runtime/doc/testing.txt b/runtime/doc/testing.txt index cce96132a1..941c440b6c 100644 --- a/runtime/doc/testing.txt +++ b/runtime/doc/testing.txt @@ -31,11 +31,7 @@ Find more information in the file src/testdir/README.txt. ============================================================================== 2. Test functions *test-functions-details* -test_garbagecollect_now() *test_garbagecollect_now()* - Like garbagecollect(), but executed right away. This must - only be called directly to avoid any structure to exist - internally, and |v:testing| must have been set before calling - any function. +See |test_garbagecollect_now()|. ============================================================================== 3. Assert functions *assert-functions-details* -- cgit