Commit Graph

18 Commits

Author SHA1 Message Date
a81d2b6703 docs(luv): replace bundled LuaCATS meta files with upstream
Synced from https://github.com/luvit/luv/blob/master/meta.lua
2025-05-06 18:47:33 +02:00
223ac7782e fix(vim.system): unclear non-executable message #33455
Problem:
When a command is not found or not executable, the error message gives
no indication about what command was actually tried.

Solution:
Always append the command name to the error message.

BEFORE:

    E5108: Error executing lua …/_system.lua:248: ENOENT: no such file or directory

AFTER:

    E5108: Error executing lua …/_system.lua:249: ENOENT: no such file or directory: "foo"

fix #33445
2025-04-16 05:06:39 -07:00
4e130c1ee4 fix(vim.system): invalid MAX_TIMEOUT for 32-bit systems #31638
The maximum signed value on 32-bit systems is 2 ^ 31 - 1. When using 2 ^ 31 for
the default timeout, the value would overflow on such systems resulting in
a negative value, which caused a stack trace when calling wait() without
a timeout.
2024-12-20 01:43:56 -08:00
734dba04d1 fix(vim.system): close pipe handles after process handle
Fixes #30846
2024-12-04 14:44:40 +00:00
ad3472e291 fix(vim.system): resolve executable paths on windows
Fixes #31107
2024-11-08 16:29:44 +00:00
3f3e4837d5 perf(validate): use lighter version
- Also fix `vim.validate()` for PUC Lua when showing errors for values
  that aren't string or number.
2024-10-17 16:53:52 +01:00
57adf8c6e0 fix(vim.ui): open() may wait indefinitely #28325
Problem:
vim.ui.open "locks up" Nvim if the spawned process does not terminate. #27986

Solution:
- Change `vim.ui.open()`:
    - Do not call `wait()`.
    - Return a `SystemObj`. The caller can decide if it wants to `wait()`.
- Change `gx` to `wait()` only a short time.
    - Allows `gx` to show a message if the command fails, without the
      risk of waiting forever.
2024-04-15 04:33:09 -07:00
9b7cf4f0be 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().
2024-02-02 21:52:01 +08:00
ce4ea638c7 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
2024-01-14 09:02:45 +01:00
2f9ee9b6cf fix(doc): improve doc generation of types using lpeg
Added a lpeg grammar for LuaCATS and use it in lua2dox.lua
2024-01-11 16:24:12 +00:00
be8b15200d fix: windows timeouts have exit code 1 2023-09-05 17:10:04 +01:00
80d1333b73 refactor(vim.system): factor out on_exit handling 2023-09-05 17:10:04 +01:00
6d5f12efd2 fix(vim.system): make timeout work properly
Mimic the behaviour of timeout(1) from coreutils.
2023-09-05 17:10:01 +01:00
a44521f46e fix(vim.system): let on_exit handle cleanup after kill
Fixes #25000
2023-09-05 10:18:26 +01:00
c43c745a14 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
2023-08-09 11:06:13 +02:00
be74807eef docs(lua): more improvements (#24387)
* docs(lua): teach lua2dox how to table

* docs(lua): teach gen_vimdoc.py about local functions

No more need to mark local functions with @private

* docs(lua): mention @nodoc and @meta in dev-lua-doc

* fixup!

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>

---------

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2023-07-18 15:42:30 +01:00
2afb04758c fix(vim.system): close check handle (#24270)
Fix hang after running vim.system() with sanitizers.
2023-07-06 12:56:19 +08:00
c0952e62fd feat(lua): add vim.system()
feat(lua): add vim.system()

Problem:

  Handling system commands in Lua is tedious and error-prone:
  - vim.fn.jobstart() is vimscript and comes with all limitations attached to typval.
  - vim.loop.spawn is too low level

Solution:

  Add vim.system().
  Partly inspired by Python's subprocess module
  Does not expose any libuv objects.
2023-06-07 13:52:23 +01:00