feat(lsp): add vim.lsp.config and vim.lsp.enable

Design goals/requirements:
- Default configuration of a server can be distributed across multiple sources.
  - And via RTP discovery.
- Default configuration can be specified for all servers.
- Configuration _can_ be project specific.

Solution:

- Two new API's:
  - `vim.lsp.config(name, cfg)`:
    - Used to define default configurations for servers of name.
    - Can be used like a table or called as a function.
    - Use `vim.lsp.confg('*', cfg)` to specify default config for all
      servers.
  - `vim.lsp.enable(name)`
    - Used to enable servers of name. Uses configuration defined
    via `vim.lsp.config()`.
This commit is contained in:
Lewis Russell
2024-11-01 16:31:51 +00:00
committed by Lewis Russell
parent ca760e645b
commit 3f1d09bc94
11 changed files with 600 additions and 75 deletions

View File

@ -1409,4 +1409,14 @@ function vim._resolve_bufnr(bufnr)
return bufnr
end
--- @generic T
--- @param x elem_or_list<T>?
--- @return T[]
function vim._ensure_list(x)
if type(x) == 'table' then
return x
end
return { x }
end
return vim