Files
neovim/runtime
Jongwook Choi d5ae5c84e9 feat(lua): completion for vim.fn, vim.v, vim.o #30472
Problem: Lua accessors for
- global, local, and special variables (`vim.{g,t,w,b,v}.*`), and
- options (`vim.{o,bo,wo,opt,opt_local,opt_global}.*`),

do not have command-line completion, unlike their vimscript counterparts
(e.g., `g:`, `b:`, `:set`, `:setlocal`, `:call <fn>`, etc.).

Completion for vimscript functions (`vim.fn.*`) is incomplete and does
not list all the available functions.

Solution: Implement completion for vimscript function, variable and
option accessors in `vim._expand_pat` through:

- `getcompletion()` for variable and vimscript function accessors, and
- `nvim_get_all_options_info()` for option accessors.

Note/Remark:

- Short names for options are yet to be implemented.

- Completions for accessors with handles (e.g. `vim.b[0]`, `vim.wo[0]`)
  are also yet to be implemented, and are left as future work, which
  involves some refactoring of options.

- For performance reasons, we may want to introduce caching for
  completing options, but this is not considered at this time since the
  number of the available options is not very big (only ~350) and Lua
  completion for option accessors appears to be pretty fast.

- Can we have a more "general" framework for customizing completions?
  In the future, we may want to improve the implementation by moving the
  core logic for generating completion candidates to each accessor (or
  its metatable) or through some central interface, rather than writing
  all the accessor-specific completion implementations in a single
  function: `vim._expand_pat`.
2024-10-04 06:48:31 -07:00
..
2024-02-16 08:57:45 +01:00
2022-08-20 10:04:55 +02:00
2024-02-01 12:06:55 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2023-08-24 11:33:06 +09:00
2024-03-14 15:04:31 +08:00
2024-05-16 14:34:32 +02:00
2024-08-29 06:11:32 +08:00