aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-04-25 04:15:58 -0700
committerGitHub <noreply@github.com>2024-04-25 04:15:58 -0700
commite0d92b9cc20b58179599f53dfa74ca821935a539 (patch)
tree29c8f5c83f2c2935c87036f7a57ff806354b4ec4 /runtime/doc
parenta1c2da56ecef9c7a0e17be02f587d7c7f9eee170 (diff)
downloadrneovim-e0d92b9cc20b58179599f53dfa74ca821935a539.tar.gz
rneovim-e0d92b9cc20b58179599f53dfa74ca821935a539.tar.bz2
rneovim-e0d92b9cc20b58179599f53dfa74ca821935a539.zip
fix(vim.ui)!: change open() to return pcall-like values #28502
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`.
Diffstat (limited to 'runtime/doc')
-rw-r--r--runtime/doc/lua.txt8
-rw-r--r--runtime/doc/news.txt2
2 files changed, 6 insertions, 4 deletions
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 92c49bca40..2909f1130f 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -2560,8 +2560,8 @@ vim.ui.open({path}) *vim.ui.open()*
vim.ui.open("https://neovim.io/")
vim.ui.open("~/path/to/file")
-- Synchronous (wait until the process exits).
- local cmd, err = vim.ui.open("$VIMRUNTIME")
- if cmd then
+ local ok, cmd = vim.ui.open("$VIMRUNTIME")
+ if ok then
cmd:wait()
end
<
@@ -2570,8 +2570,8 @@ vim.ui.open({path}) *vim.ui.open()*
• {path} (`string`) Path or URL to open
Return (multiple): ~
- (`vim.SystemObj?`) Command object, or nil if not found.
- (`string?`) Error message on failure
+ (`boolean`) false if command not found, else true.
+ (`vim.SystemObj|string`) Command object, or error message on failure
See also: ~
• |vim.system()|
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index c05e060920..537542ee46 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -157,6 +157,8 @@ unreleased features on Nvim HEAD.
• Renamed vim.tbl_isarray() to vim.isarray().
+• Changed |vim.ui.open()| return-signature to match pcall() convention.
+
==============================================================================
NEW FEATURES *news-features*