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`.
Allow users to add packages to the end of `PATH` in the neovim wrapper.
This is useful for LSP versions that might need to be overriden based on
the environment, e.g. `haskell-language-server` versions provided by a
project's devshell.
Previously, specifying plugins as packages in the
`performance.combinePlugins.standalonePlugins` option did not work when
the `performance.byteCompileLua` option was also enabled. This issue was
due to several package transformations performed by the
`byteCompileLua` which broke package comparison.
There are at least three methods to fix the issue:
- Change transformation order: combine plugins first, then byte-compile
them.
- Compare every possible transformation when determining if plugins are
standalone.
- Get the name of the package and use it for comparison.
The first method did not work because the current `byteCompileLuaDrv`
implementation does not support symlinks to directories. The second
method appears too fragile. This commit implements the third method, as
it requires minimal code changes and is straightforward. The downside is
that it might exclude multiple packages with the same name, although
this should be rare.
Previously only extraLuaPackages themselves were byte-compiled, not
theirs dependencies. This commit fixes that by compiling lua packages
recursively. It uses byte-compile-lua-lib.nix shared file.
Also this commit uses the shared stub lua libraries for extraLuaPackages
byte-compiling test.
This commit replaces custom lua plugins in tests with shared stub
plugins from utils module.
After this change the test has started to fail. Debugging this issue
I found out that dependencies of plugins weren't processed.
This commit improves the test assertion to detect duplicated
dependencies in this case and fixes the underlying issue by also
processing dependencies.
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.