summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/lua/ui_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-20refactor(test): drop deprecated exc_exec #39242Justin M. Keyes1
2026-03-11docs: api, messages, lsp, trustJustin M. Keyes1
gen_vimdoc.lua: In prepare for the upcoming release, comment-out the "Experimental" warning for prerelease features.
2026-02-21test(ui): failure in lua/ui_spec.lua in headless OS (no GUI) #37975wjyoung651
2026-02-12docs: lsp, options, promptbufJustin M. Keyes1
Close #37630 Close #37682 Close #37762 Close #37785 Co-authored-by: Daniel Schmitt <d.schmitt@lansoftware.de> Co-authored-by: Duane Hilton <duane9@gmail.com> Co-authored-by: NeOzay <colpaert.benoit@gmail.com> Co-authored-by: Yi Ming <ofseed@foxmail.com> Co-authored-by: "Justin M. Keyes" <justinkz@gmail.com>
2025-10-12fix(help): wrong tag url in third-party help docs #36115Yochem van Rosmalen1
fix(help): only set url for nvim-owned tags Problem: 1. gx on |nonexistingtag| opens https://neovim.io/doc/user/helptag.html?nonexistingtag. 2. b:undo_ftplugin doesn't remove url extmarks. Solution: 1. Check if the tag is defined in a help file in $VIMRUNTIME. 2. Solution: clear namespace for buffer in b:undo_ftplugin.
2025-09-15feat(help): gx opens help tag in web browser #35778Yochem van Rosmalen1
Problem: `gx` does not work on tags in help buffers to open the documentation of that tag in the browser. Solution: Get the `optionlink`, `taglink` and `tag` TS nodes and set extmark "url" property. `gx` then discovers the extmark "url" and opens it.
2024-10-18feat(vim.ui.open): support lemonade #30845Uthman Mohamed1
2024-09-16test(vim.ui.open): opt.cmdJustin M. Keyes1
2024-05-03fix(vim.ui)!: change open() to return `result|nil, errmsg|nil` #28612Justin M. Keyes1
reverts e0d92b9cc20b58179599f53dfa74ca821935a539 #28502 Problem: `vim.ui.open()` has a `pcall()` like signature, under the assumption that this is the Lua idiom for returning result-or-error. However, the `result|nil, errmsg|nil` pattern: - has precedent in: - `io.open` - `vim.uv` (`:help luv-error-handling`) - has these advantages: - Can be used with `assert()`: ``` local result, err = assert(foobar()) ``` - Allows LuaLS to infer the type of `result`: ``` local result, err = foobar() if err then ... elseif result then ... end ``` Solution: - Revert to the `result|nil, errmsg|nil` pattern. - Document the pattern in our guidelines.
2024-04-25fix(vim.ui)!: change open() to return pcall-like values #28502Justin M. Keyes1
Problem: `vim.ui.open` unnecessarily invents a different success/failure convention. Its return type was changed in 57adf8c6e01d, so we might as well change it to have a more conventional form. Solution: Change the signature to use the `pcall` convention of `status, result`.
2024-04-23test: improve test conventionsdundargoc1
Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
2024-04-20fix(vim.ui.open): try wslview before explorer.exe #28424Justin M. Keyes1
Problem: explorer.exe is unreliable on WSL. Solution: Try wslview before explorer.exe. fix #28410
2024-04-15fix(vim.ui): open() may wait indefinitely #28325Justin M. Keyes1
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-10refactor(test): inject after_each differentlyLewis Russell1
2024-04-08test: improve test conventionsdundargoc1
Work on https://github.com/neovim/neovim/issues/27004.
2024-02-20fix(vim.ui.open): use explorer.exe instead of wslview #26947Vu Nhat Chuong1
Problem: `vim.ui.open` uses `wslview`, which is slow and require a package from external PPA: https://wslutiliti.es/wslu/install.html#ubuntu Solution: Use `explorer.exe` instead. WSL supports it by default: https://learn.microsoft.com/en-us/windows/wsl/filesystems#view-your-current-directory-in-windows-file-explorer
2024-01-03refactor: format test/*Justin M. Keyes1
2023-07-21test(vim.ui.open): mock failure on WindowsJustin M. Keyes1
Problem: On Windows, `rundll32` exits zero (success) even when given a non-existent file. Solution: Mock vim.system() on Windows to force a "failure" case.
2023-07-06fix(vim.system): close check handle (#24270)zeertzjq1
Fix hang after running vim.system() with sanitizers.
2023-07-05fix(vim.ui.open): return (don't show) error messageJustin M. Keyes1
Problem: Showing an error via vim.notify() makes it awkward for callers such as lsp/handlers.lua to avoid showing redundant errors. Solution: Return the message instead of showing it. Let the caller decide whether and when to show the message.
2023-07-04fix(gx): visual selection, expand env varsJustin M. Keyes1
--- Rejected experiment: move vim.ui.open() to vim.env.open() Problem: `vim.ui` is where user-interface "providers" live, which can be overridden. It would also be useful to have a "providers" namespace for platform-specific features such as "open", clipboard, python, and the other providers listed in `:help providers`. We could overload `vim.ui` to serve that purpose as the single "providers" namespace, but `vim.ui.nodejs()` for example seems awkward. Solution: `vim.env` currently has too narrow of a purpose. Overload it to also be a namespace for `vim.env.open`. diff --git a/runtime/lua/vim/_meta.lua b/runtime/lua/vim/_meta.lua index 913f1fe20348..17d05ff37595 100644 --- a/runtime/lua/vim/_meta.lua +++ b/runtime/lua/vim/_meta.lua @@ -37,8 +37,28 @@ local options_info = setmetatable({}, { end, }) -vim.env = setmetatable({}, { - __index = function(_, k) +vim.env = setmetatable({ + open = setmetatable({}, { + __call = function(_, uri) + print('xxxxx'..uri) + return true + end, + __tostring = function() + local v = vim.fn.getenv('open') + if v == vim.NIL then + return nil + end + return v + end, + }) + }, + { + __index = function(t, k, ...) + if k == 'open' then + error() + -- vim.print({...}) + -- return rawget(t, k) + end local v = vim.fn.getenv(k) if v == vim.NIL then return nil
2022-11-13test(lua/ui_spec): fix Ctrl-C test flakiness (#21039)zeertzjq1
Prevent Ctrl-C from flushing the command that starts the prompt.
2022-11-12fix: vim.ui.input always calls callback #21006Steven Arcangeli1
Followup to #20883 Related: #18144 This patch changes the behavior of the default `vim.ui.input` when the user aborts with `<C-c>`. Currently, it produces an error message + stack and causes `on_confirm` to not be called. With this patch, `<C-c>` will cause `on_confirm` to be called with `nil`, the same behavior as when the user aborts with `<Esc>`. I can think of three good reasons why the behavior should be this way: 1. Easier for the user to understand** It's not intuitive for there to be two ways to abort an input dialog that have _different_ outcomes. As a user, I would expect any action that cancels the input to leave me in the same state. As a plugin author, I see no value in having two possible outcomes for aborting the input. I have to handle both cases, but I can't think of a situation where I would want to treat one differently than the other. 2. Provides an API that can be overridden by other implementations** The current contract of "throw an error upon `<C-c>`" cannot be replicated by async implementations of `vim.ui.input`. If the callsite wants to handle the case of the user hitting `<C-c>` they need to use `pcall(vim.ui.input, ...)`, however an async implementation will instantly return and so there will be no way for it to produce the same error-throwing behavior when the user inputs `<C-c>`. This makes it impossible to be fully API-compatible with the built-in `vim.ui.input`. 3. Provides a useful guarantee to the callsite** As a plugin author, I want the guarantee that `on_confirm` will _always_ be called (only catastrophic errors should prevent this). If I am in the middle of some async thread of logic, I need some way to resume that logic after handing off control to `vim.ui.input`. The only way to handle the `<C-c>` case is with `pcall`, which as already mentioned, breaks down if you're using an alternative implementation.
2022-11-08fix(vim.ui.input): return empty string when inputs nothing (#20883)Jongwook Choi1
fix(vim.ui.input): return empty string when inputs nothing The previous behavior of `vim.ui.input()` when typing <CR> with no text input (with an intention of having the empty string as input) was to execute `on_confirm(nil)`, conflicting with its documentation. Inputting an empty string should now correctly execute `on_confirm('')`. This should be clearly distinguished from cancelling or aborting the input UI, in which case `on_confirm(nil)` is executed as before.
2022-06-28fix(vim.ui.input): accept nil or empty "opts" #191090x74696d6d791
Fix #18143
2021-11-07feat(ui): add vim.ui.input and use in lsp rename (#15959)Sebastian Lyng Johansen1
* vim.ui.input is an overridable function that prompts for user input * take an opts table and the `on_confirm` callback, see `:help vim.ui.input` for more details * defaults to a wrapper around vim.fn.input(opts) * switches the built-in client's rename handler to use vim.ui.input by default
2021-09-27fix(ui): s/format_entry/format_item to match docs (#15819)Mathias Fußenegger1
Follow up to https://github.com/neovim/neovim/pull/15771
2021-09-27feat(ui): add vim.ui.select and use in code actions (#15771)Mathias Fußenegger1
Continuation of https://github.com/neovim/neovim/pull/15202 A plugin like telescope could override it with a fancy implementation and then users would get the telescope-ui within each plugin that utilizes the vim.ui.select function. There are some plugins which override the `textDocument/codeAction` handler solely to provide a different UI. With custom client commands and soon codeAction resolve support, it becomes more difficult to implement the handler right - so having a dedicated way to override the picking function will be useful.