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/lua/vim/secure.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'runtime/lua/vim/secure.lua') diff --git a/runtime/lua/vim/secure.lua b/runtime/lua/vim/secure.lua index 837738c041..893b3e1877 100644 --- a/runtime/lua/vim/secure.lua +++ b/runtime/lua/vim/secure.lua @@ -119,9 +119,8 @@ end --- - path (string|nil): Path to a file to update. Mutually exclusive with {bufnr}. --- Cannot be used when {action} is "allow". --- - 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 boolean success true if operation was successful +---@return string msg full path if operation was successful, else error message function M.trust(opts) vim.validate({ path = { opts.path, 's', true }, -- cgit