From 2f9ee9b6cfc61a0504fc0bc22bdf481828e2ea91 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Tue, 9 Jan 2024 17:36:46 +0000 Subject: fix(doc): improve doc generation of types using lpeg Added a lpeg grammar for LuaCATS and use it in lua2dox.lua --- runtime/lua/vim/_system.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim/_system.lua') diff --git a/runtime/lua/vim/_system.lua b/runtime/lua/vim/_system.lua index 9279febddf..9e935b7e95 100644 --- a/runtime/lua/vim/_system.lua +++ b/runtime/lua/vim/_system.lua @@ -1,6 +1,6 @@ local uv = vim.uv ---- @class SystemOpts +--- @class vim.SystemOpts --- @field stdin? string|string[]|true --- @field stdout? fun(err:string?, data: string?)|false --- @field stderr? fun(err:string?, data: string?)|false @@ -302,7 +302,7 @@ end --- Run a system command --- --- @param cmd string[] ---- @param opts? SystemOpts +--- @param opts? vim.SystemOpts --- @param on_exit? fun(out: vim.SystemCompleted) --- @return vim.SystemObj function M.run(cmd, opts, on_exit) -- cgit From ce4ea638c703275aedadb3794efc56dcb782c908 Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Tue, 9 Jan 2024 18:04:27 -0500 Subject: fix(lsp): fix incorrect typing and doc for `vim.lsp.rpc` Typings introduced in #26032 and #26552 have a few conflicts, so we merge and clean them up. We also fix some incorrect type annotation in the `vim.lsp.rpc` package. See the associated PR for more details. Summary: - vim.rpc.Dispatchers -> vim.lsp.rpc.Dispatchers - vim.lsp.rpc.Error -> lsp.ResponseError - Revise docs --- runtime/lua/vim/_system.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim/_system.lua') diff --git a/runtime/lua/vim/_system.lua b/runtime/lua/vim/_system.lua index 9e935b7e95..efad3f88cf 100644 --- a/runtime/lua/vim/_system.lua +++ b/runtime/lua/vim/_system.lua @@ -61,7 +61,7 @@ end --- @field wait fun(self: vim.SystemObj, timeout?: integer): vim.SystemCompleted --- @field kill fun(self: vim.SystemObj, signal: integer|string) --- @field write fun(self: vim.SystemObj, data?: string|string[]) ---- @field is_closing fun(self: vim.SystemObj): boolean? +--- @field is_closing fun(self: vim.SystemObj): boolean local SystemObj = {} --- @param state vim.SystemState @@ -140,7 +140,7 @@ end --- @return boolean function SystemObj:is_closing() local handle = self._state.handle - return handle == nil or handle:is_closing() + return handle == nil or handle:is_closing() or false end ---@param output fun(err:string?, data: string?)|false -- cgit From 9b7cf4f0beb35b640846f92ac522372967ca6695 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 2 Feb 2024 21:52:01 +0800 Subject: fix(vim.system): don't process non-fast events during wait() (#27300) Problem: Processing non-fast events during SystemObj:wait() may cause two pieces of code to interfere with each other, and is different from jobwait(). Solution: Don't process non-fast events during SystemObj:wait(). --- runtime/lua/vim/_system.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim/_system.lua') diff --git a/runtime/lua/vim/_system.lua b/runtime/lua/vim/_system.lua index efad3f88cf..e97a5fc6c3 100644 --- a/runtime/lua/vim/_system.lua +++ b/runtime/lua/vim/_system.lua @@ -94,14 +94,14 @@ function SystemObj:wait(timeout) local done = vim.wait(timeout or state.timeout or MAX_TIMEOUT, function() return state.result ~= nil - end) + end, nil, true) if not done then -- Send sigkill since this cannot be caught self:_timeout(SIG.KILL) vim.wait(timeout or state.timeout or MAX_TIMEOUT, function() return state.result ~= nil - end) + end, nil, true) end return state.result -- cgit