Adds two internal per-server options: `packages.prefix` & `packages.suffix`.
These options allow the server module to install multiple packages, and
control which end up being prefixed or suffixed on the PATH.
This simplifies the propagating code in `modules/lsp/servers/default.nix`,
which can now zip up the enabled server `packages` attrs.
Adding a module in the following places will import the module into that
specific server's submodule.
This allows creating server-specific options.
Added a test case to ensure all custom modules correspond to an actual
server option to avoid accidental dead code.
`shorthandOnlyDefinesConfig` is true by default for `lib.types.submodule`,
and false by default for `lib.types.submoduleWith` and `lib.evalModules`.
Since we rely on it for our `lsp.servers.*.config` option, let's enable
it explicitly.
The `lsp.servers.<name>` option description links to the server's
homepage if it can evaluate the default package's `meta.homepage`.
However, users may evaluate this description, e.g. when building NixOS
docs with `documentation.nixos.includeAllModules`. Further, users may
have a different nixpkgs revisions to ours. Therefore, we need to allow
for the package not being in nixpkgs.
Since `mkPackageOption` will throw in the default, we can catch it with
`tryEval`.
- Re-implement setup wrapping and capabilities to preserve existing
behaviour
- Alias `package` options to new lsp module
- Alias `packageFallback` options to new lsp module
- Alias `preConfig` and `postConfig` to `lsp.luaConfig`
We only use `mode`, `key`, `action`, and `options`; so explicitly
inherit those.
This means we don't serialise attrs that aren't needed at runtime,
such as `lspBufAction`.
Similar to `plugins.lsp.onAttach`, implement a "global" equivalent to
the per-server `on_attach` callback.
This is implemented using a `LspAttach` autoCmd.
Initial LSP keymaps option, inspired by `keymapsOnEvent` and
`plugins.lsp.keymaps`.
Users can define `lspBufAction` instead of `action` if they wish to use
a `vim.lsp.buf.<action>` callback.
Introduce a bespoke `global-server.nix` module. This is less DRY, but
much simpler.
The `lsp.servers."*"` options are different enough from the other
`lsp.servers.<name>` options that it is simpler to just declare them
separately.
Now that we have a dedicated `global-server.nix` module, we no longer
need to split the normal server module into `server.nix`+`server-base.nix`
This partially reverts f2e96b67a3
`"*"` is effectively a meta server, where shared config/defaults can be
set.
It shouldn't have options like `activate` or `package` which relate to
"real" servers. Therefore, we'll use `server-base.nix` directly, instead
of the full `server.nix` module.
`config` is a loaded term within modules and options.
`settings` is the name usually used for freeform config in nixvim and
most other module configurations.
Convert the `attrsOf (servers.nix)` option to a freeform submodule.
Declare a `servers.nix` option for each lsp server listed in
`lsp-packages.nix` that has a known nixpkgs package.
A simplified replacement for `plugins.lsp`.
Eventually, once the `lsp` and `plugins.lspconfig` modules are mature,
`plugins.lsp` will be deprecated and/or aliased.
This allows users to override the name used for a given `lsp.servers.*`
entry. The default is still the attr-name.
This may be useful to inject raw lua, or to configure the same server in
different ways via different attrs.