neovim/runtime/lua/vim
Mathias Fußenegger 341ef46d00
docs(lsp): remove lsp.buf_request from docs (#19738)
This starts a soft phase-out of `buf_request`.

`buf_request` is quite error prone:

- Positional `params` depend on the client because of the
  `offset_encoding`. Currently if there is one client using UTF-8 offset
  encoding and another using UTF-16, the positions in the request are
  wrong for one of the clients. To solve this the params would need to
  be created per client instead of once for all of them.

- `handler` is called *per* client but many users of it assume it is
  only called once.

  This can lead to a "select n + 1"
  kind of problem, where the handler makes another call to `buf_request`,
  multiplying the amount of requests.
  (There are in fact still some places where this happens in core)

  Or it leads to erratic behavior if called multiple times (E.g. the
  quicklist list flickering & being overwritten)
  (See hover or references implementation)

  `buf_request_all` returns an aggregate of the responses which is more
  sensible as it avoids this problem.

  For off-spec extensions it also has the problem that it sends requests to
  clients which cannot handle a given request.

Given that `buf_request` is in use by a lot of plugins this starts a
soft-phase out. Planned Steps:

- Remove from docs
- Provide an alternative, either `buf_request_all`, maybe with
  extensions (params being a function), or an entirely new method.
- Mark as deprecated in 0.9
- Remove in 0.10

To note:

- `buf_request_all` currently isn't ideal either because it suffers from
the `params` problem as well.

- This implies that the `vim.lsp.with` pattern will die, because the
  global handlers as they are don't fit a multi-client model, as most of
  the time an aggregate is needed.
2022-08-18 10:57:17 +02:00
..
filetype vim-patch:partial: 48c3f4e0bff7 (#19684) 2022-08-09 10:43:28 +02:00
lsp docs(lsp): rename on-list-handler to lsp-on-list-handler (#19813) 2022-08-17 12:39:38 +02:00
treesitter fix(treesitter): don't error when node argument of predicate is nil (#19355) 2022-07-14 12:18:03 +02:00
_editor.lua docs: fix typos (#19588) 2022-08-03 09:47:16 +08:00
_init_packages.lua chore: format runtime with stylua 2022-05-09 16:31:55 +02:00
_meta.lua refactor(lua): reformat with stylua 0.14.0 (#19264) 2022-07-07 18:27:18 +02:00
compat.lua chore: format runtime with stylua 2022-05-09 16:31:55 +02:00
diagnostic.lua docs: fix typos (#19024) 2022-07-31 16:46:38 +08:00
F.lua chore: format runtime with stylua 2022-05-09 16:31:55 +02:00
filetype.lua vim-patch:9.0.0197: astro files are not detected (#19755) 2022-08-13 15:11:03 +02:00
fs.lua refactor(lua): reformat with stylua 0.14.0 (#19264) 2022-07-07 18:27:18 +02:00
health.lua fix(checkhealth): skip vim.health #18816 2022-06-01 07:10:10 -07:00
highlight.lua refactor(lua): replace vim.cmd use with API calls (#19283) 2022-07-09 18:40:32 +02:00
inspect.lua refactor(lua): reformat with stylua 0.14.0 (#19264) 2022-07-07 18:27:18 +02:00
keymap.lua docs(lua): clarify vim.keymap.set() opts (#19761) 2022-08-14 06:38:31 +08:00
lsp.lua docs(lsp): remove lsp.buf_request from docs (#19738) 2022-08-18 10:57:17 +02:00
shared.lua docs(lua): add Lua 5.1 reference manual (#19663) 2022-08-08 18:58:32 +02:00
treesitter.lua chore: format runtime with stylua 2022-05-09 16:31:55 +02:00
ui.lua fix(vim.ui.input): accept nil or empty "opts" #19109 2022-06-28 02:53:15 -07:00
uri.lua chore: format runtime with stylua 2022-05-09 16:31:55 +02:00