Justin M. Keyes
40ce857797
fix(vim.ui)!: change open() to return result|nil, errmsg|nil
#28612
...
reverts e0d92b9cc2
#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-05-03 03:20:03 -07:00
..
2024-05-02 15:57:06 +02:00
2023-07-25 05:07:13 -07:00
2024-04-30 04:30:21 -07:00
2023-12-28 22:41:01 +01:00
2024-04-27 05:51:52 +08:00
2024-04-26 11:12:49 -05:00
2023-10-29 16:02:32 +08:00
2024-03-26 18:30:17 +08:00
2019-05-09 20:27:11 -04:00
2024-04-30 04:30:21 -07:00
2024-01-17 14:01:39 +08:00
2023-12-16 14:43:03 +01:00
2024-04-23 18:17:04 +02:00
2024-04-20 19:31:00 +08:00
2024-05-03 03:20:03 -07:00
2024-04-30 13:39:27 +01:00
2023-04-17 15:46:24 +08:00
2023-10-20 13:03:36 +02:00
2024-04-12 16:56:22 +08:00
2024-03-10 23:20:44 +00:00
2024-02-08 19:07:31 +08:00
2023-12-13 20:31:16 +01:00
2024-04-19 14:49:33 +08:00
2023-09-17 20:29:18 +08:00
2024-02-25 16:38:34 +08:00
2021-09-10 08:48:27 +02:00
2023-06-25 17:14:28 +02:00
2023-10-29 16:02:32 +08:00
2024-02-25 16:38:34 +08:00
2024-04-05 18:08:54 +08:00
2024-03-26 18:30:17 +08:00
2023-12-13 18:31:05 +01:00
2024-04-11 07:39:29 +08:00
2023-06-22 03:44:51 -07:00
2023-07-25 05:07:13 -07:00
2023-04-29 09:20:52 +08:00
2024-02-29 22:54:57 +01:00
2024-03-26 18:30:17 +08:00
2024-03-26 18:30:17 +08:00
2024-04-11 07:39:29 +08:00
2023-05-13 21:33:22 +02:00
2024-05-02 07:26:07 -07:00
2023-12-06 08:04:21 +08:00
2024-05-03 03:20:03 -07:00
2024-03-12 13:51:53 +08:00
2024-02-22 10:07:04 +01:00
2024-03-12 13:51:53 +08:00
2023-11-17 12:58:57 +01:00
2024-03-14 06:44:50 +08:00
2022-10-14 08:01:13 -07:00
2024-01-18 00:14:48 -08:00
2024-04-15 13:54:33 +02:00
2024-05-03 03:20:03 -07:00
2024-04-30 04:30:21 -07:00
2022-12-11 18:41:26 -08:00
2024-04-30 04:30:21 -07:00
2024-04-27 05:52:47 +08:00
2023-11-14 23:29:09 +01:00
2023-05-05 18:15:44 +02:00
2023-07-25 20:58:09 +08:00
2024-02-25 16:38:34 +08:00
2018-10-29 09:55:07 +01:00
2023-01-01 15:05:13 +01:00
2023-06-25 17:14:28 +02:00
2015-08-15 15:25:30 -03:00
2023-11-06 19:03:08 +08:00
2024-03-29 09:43:26 -05:00
2024-04-30 06:02:38 +08:00
2024-03-26 18:30:17 +08:00
2024-01-18 00:14:48 -08:00
2024-04-30 04:30:21 -07:00
2023-02-21 23:50:29 +08:00
2024-04-15 03:43:33 +08:00
2023-01-01 15:05:13 +01:00
2023-06-19 08:40:33 -07:00
2023-09-28 05:22:09 +08:00
2023-11-27 17:43:13 +08:00
2023-06-11 12:40:22 +01:00
2024-03-26 18:30:17 +08:00
2024-04-18 23:39:26 +02:00
2024-05-02 11:39:31 +02:00
2024-03-26 05:04:57 +08:00
2024-04-26 13:16:12 -05:00
2023-09-29 10:57:02 -05:00
2023-08-09 11:06:13 +02:00
2023-08-10 17:28:02 +08:00
2024-04-30 04:30:21 -07:00
2024-04-23 08:20:36 +08:00
2024-04-30 04:30:21 -07:00
2023-08-10 17:45:36 +08:00
2023-10-21 18:46:52 +08:00
2023-05-15 09:38:32 +02:00
2023-09-25 18:23:15 +02:00
2023-04-23 15:22:55 +02:00
2022-02-24 18:13:44 +08:00
2023-08-10 17:28:04 +08:00
2023-01-03 10:07:43 +00:00
2022-02-24 18:13:44 +08:00
2023-01-01 15:05:21 +01:00
2023-06-25 17:14:28 +02:00
2023-01-01 15:05:21 +01:00
2023-06-19 08:40:33 -07:00
2023-06-25 17:14:28 +02:00
2023-01-01 15:05:21 +01:00
2023-07-25 05:07:13 -07:00
2023-06-25 17:14:28 +02:00
2021-05-01 22:29:03 -04:00
2023-06-25 17:14:28 +02:00
2023-01-01 15:05:21 +01:00
2018-10-29 10:01:44 +01:00
2021-04-29 09:27:19 -04:00
2023-06-25 17:14:28 +02:00
2023-06-26 11:29:12 +02:00
2024-04-30 05:54:03 +08:00
2021-04-29 20:42:16 -04:00
2023-01-01 15:05:21 +01:00
2023-06-26 11:29:12 +02:00
2024-04-27 05:52:15 +08:00
2023-01-01 15:05:21 +01:00
2023-07-25 05:07:13 -07:00
2021-04-27 09:21:34 -04:00
2023-06-19 08:40:33 -07:00
2023-01-03 10:07:43 +00:00
2024-05-02 15:57:06 +02:00
2023-06-25 17:14:28 +02:00
2024-04-30 09:37:45 -07:00
2024-04-15 03:43:33 +08:00
2024-04-30 07:04:42 +08:00
2024-03-08 23:24:04 +00:00