mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/lspconfig: init
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 commit is contained in:
parent
29aa60b43a
commit
556eb29548
3 changed files with 92 additions and 2 deletions
|
@ -29,10 +29,10 @@ in
|
||||||
LSP servers to enable and/or configure.
|
LSP servers to enable and/or configure.
|
||||||
|
|
||||||
This option is implemented using neovim's `vim.lsp` lua API.
|
This option is implemented using neovim's `vim.lsp` lua API.
|
||||||
If you prefer to use [nvim-lspconfig], see [`plugins.lsp`].
|
If you prefer to use [nvim-lspconfig], see [`plugins.lspconfig`].
|
||||||
|
|
||||||
[nvim-lspconfig]: https://github.com/neovim/nvim-lspconfig
|
[nvim-lspconfig]: https://github.com/neovim/nvim-lspconfig
|
||||||
[`plugins.lsp`]: https://nix-community.github.io/nixvim/plugins/lsp/index.html
|
[`plugins.lspconfig`]: https://nix-community.github.io/nixvim/plugins/lspconfig/index.html
|
||||||
'';
|
'';
|
||||||
default = { };
|
default = { };
|
||||||
example = {
|
example = {
|
||||||
|
|
66
plugins/by-name/lspconfig/default.nix
Normal file
66
plugins/by-name/lspconfig/default.nix
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
options,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
# cfg = config.plugins.lspconfig;
|
||||||
|
opts = options.plugins.lspconfig;
|
||||||
|
oldCfg = config.plugins.lsp;
|
||||||
|
oldOpts = options.plugins.lsp;
|
||||||
|
in
|
||||||
|
lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
|
name = "lspconfig";
|
||||||
|
packPathName = "nvim-lspconfig";
|
||||||
|
package = "nvim-lspconfig";
|
||||||
|
|
||||||
|
maintainers = with lib.maintainers; [
|
||||||
|
GaetanLepage
|
||||||
|
MattSturgeon
|
||||||
|
khaneliman
|
||||||
|
traxys
|
||||||
|
];
|
||||||
|
|
||||||
|
description = ''
|
||||||
|
[nvim-lspconfig] provides default configs for many language servers, but it does not enable any of them.
|
||||||
|
You should use the [`lsp`] module to configure and enable LSP servers.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> This plugin module will soon replace [`plugins.lsp`].
|
||||||
|
>
|
||||||
|
> Both `${opts.enable}` and `${oldOpts.enable}` will install nvim-lspconfig,
|
||||||
|
> however the older [`plugins.lsp`] module includes additional options and
|
||||||
|
> setup that relate to neovim's builtin LSP and are now being moved to the
|
||||||
|
> new [`lsp`] module.
|
||||||
|
|
||||||
|
[`lsp`]: ../../lsp/servers.md
|
||||||
|
[`plugins.lsp`]: ../lsp/index.md
|
||||||
|
[nvim-lspconfig]: ${opts.package.default.meta.homepage}
|
||||||
|
'';
|
||||||
|
|
||||||
|
# nvim-lspconfig provides configs for `vim.lsp.config` and requires no setup
|
||||||
|
# all configuration should be done via nvim's builtin `vim.lsp` API
|
||||||
|
callSetup = false;
|
||||||
|
hasLuaConfig = false;
|
||||||
|
hasSettings = false;
|
||||||
|
|
||||||
|
extraConfig = {
|
||||||
|
warnings = lib.nixvim.mkWarnings "plugins.lspconfig" [
|
||||||
|
{
|
||||||
|
when = oldCfg.enable;
|
||||||
|
message = ''
|
||||||
|
Both `${opts.enable}' and `${oldOpts.enable}' configure the same plugin (nvim-lspconfig).
|
||||||
|
${lib.pipe
|
||||||
|
[ opts oldOpts ]
|
||||||
|
[
|
||||||
|
(builtins.catAttrs "enable")
|
||||||
|
(map (o: "`${o}' defined in ${lib.options.showFiles o.files}."))
|
||||||
|
lib.strings.concatLines
|
||||||
|
]
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
24
tests/test-sources/plugins/by-name/lspconfig/default.nix
Normal file
24
tests/test-sources/plugins/by-name/lspconfig/default.nix
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
empty = {
|
||||||
|
plugins.lspconfig.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: test integration with `vim.lsp.enable`, etc
|
||||||
|
# TODO: test some examples of enabling/configuring specific LSP servers
|
||||||
|
|
||||||
|
plugins-lsp-warning = {
|
||||||
|
plugins.lsp.enable = true;
|
||||||
|
plugins.lspconfig.enable = true;
|
||||||
|
|
||||||
|
test.warnings = expect: [
|
||||||
|
(expect "count" 1)
|
||||||
|
(expect "any" ''
|
||||||
|
Nixvim (plugins.lspconfig): Both `plugins.lspconfig.enable' and `plugins.lsp.enable' configure the same plugin (nvim-lspconfig).
|
||||||
|
'')
|
||||||
|
(expect "any" "`plugins.lspconfig.enable' defined in `/nix/store/")
|
||||||
|
(expect "any" "`plugins.lsp.enable' defined in `/nix/store/")
|
||||||
|
];
|
||||||
|
|
||||||
|
test.buildNixvim = false;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue