mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-02 21:34:33 +02:00
plugins/nixd: Adapt to new options
Note that due to the structure of the code we can't introduce deprecation warnings, it results in: cannot find attribute `plugins.lsp.servers.nixd.settings.XXX`
This commit is contained in:
parent
2fd3a0493c
commit
908932b53c
3 changed files with 55 additions and 59 deletions
|
@ -4,11 +4,13 @@
|
|||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
}@args:
|
||||
with lib;
|
||||
let
|
||||
lspHelpers = import ../helpers.nix { inherit lib config pkgs; };
|
||||
|
||||
nixdSettings = import ./nixd.nix args;
|
||||
|
||||
servers = [
|
||||
{
|
||||
name = "ansiblels";
|
||||
|
@ -408,6 +410,7 @@ let
|
|||
description = "nixd for Nix";
|
||||
package = pkgs.nixd;
|
||||
settings = cfg: { nixd = cfg; };
|
||||
settingsOptions = nixdSettings.options;
|
||||
}
|
||||
{
|
||||
name = "nushell";
|
||||
|
@ -660,10 +663,11 @@ in
|
|||
imports = lib.lists.map lspHelpers.mkLsp servers ++ [
|
||||
./ccls.nix
|
||||
./efmls-configs.nix
|
||||
./nixd.nix
|
||||
./pylsp.nix
|
||||
./rust-analyzer.nix
|
||||
./svelte.nix
|
||||
./vls.nix
|
||||
];
|
||||
|
||||
config = lib.mkMerge [ nixdSettings.config ];
|
||||
}
|
||||
|
|
|
@ -10,52 +10,52 @@ let
|
|||
cfg = config.plugins.lsp.servers.nixd;
|
||||
in
|
||||
{
|
||||
# Options: https://github.com/nix-community/nixd/blob/main/docs/user-guide.md#configuration
|
||||
options.plugins.lsp.servers.nixd.settings = {
|
||||
# The evaluation section, provide auto completion for dynamic bindings.
|
||||
eval = {
|
||||
target = {
|
||||
args = helpers.defaultNullOpts.mkNullable (with types; listOf str) "[]" ''
|
||||
Accept args as "nix eval".
|
||||
'';
|
||||
|
||||
installable = helpers.defaultNullOpts.mkStr "" ''
|
||||
"nix eval"
|
||||
'';
|
||||
};
|
||||
|
||||
depth = helpers.defaultNullOpts.mkInt 0 "Extra depth for evaluation";
|
||||
|
||||
workers = helpers.defaultNullOpts.mkInt 3 "The number of workers for evaluation task.";
|
||||
};
|
||||
|
||||
# Options:
|
||||
# - https://github.com/nix-community/nixd/blob/main/nixd/docs/configuration.md
|
||||
# - https://github.com/nix-community/nixd/blob/main/nixd/include/nixd/Controller/Configuration.h
|
||||
options = {
|
||||
formatting = {
|
||||
command = helpers.defaultNullOpts.mkStr "nixpkgs-fmt" ''
|
||||
command = helpers.defaultNullOpts.mkListOf types.str ''[ "nixpkgs-fmt" ]'' ''
|
||||
Which command you would like to do formatting.
|
||||
Explicitly set to `"nixpkgs-fmt"` will automatically add `pkgs.nixpkgs-fmt` to the nixvim
|
||||
Explicitly set to `["nixpkgs-fmt"]` will automatically add `pkgs.nixpkgs-fmt` to the nixvim
|
||||
environment.
|
||||
'';
|
||||
};
|
||||
|
||||
options = {
|
||||
enable = helpers.defaultNullOpts.mkBool true ''
|
||||
Enable option completion task.
|
||||
If you are writing a package, disable this
|
||||
options =
|
||||
let
|
||||
provider = types.submodule {
|
||||
options = {
|
||||
expr = mkOption {
|
||||
type = types.str;
|
||||
description = "Expression to eval. Select this attrset as eval .options";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
helpers.mkNullOrOption (with helpers.nixvimTypes; attrsOf (maybeRaw provider)) ''
|
||||
Tell the language server your desired option set, for completion.
|
||||
This is lazily evaluated.
|
||||
'';
|
||||
|
||||
target = {
|
||||
args = helpers.defaultNullOpts.mkNullable (with types; listOf str) "[]" ''
|
||||
Accept args as "nix eval".
|
||||
'';
|
||||
|
||||
installable = helpers.defaultNullOpts.mkStr "" ''
|
||||
"nix eval"
|
||||
'';
|
||||
};
|
||||
};
|
||||
nixpkgs =
|
||||
let
|
||||
provider = types.submodule {
|
||||
options = {
|
||||
expr = mkOption {
|
||||
type = types.str;
|
||||
description = "Expression to eval. Treat it as `import <nixpkgs> { }`";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
helpers.mkNullOrOption (helpers.nixvimTypes.maybeRaw provider) ''
|
||||
This expression will be interpreted as "nixpkgs" toplevel
|
||||
Nixd provides package, lib completion/information from it.
|
||||
'';
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
extraPackages = optional (cfg.settings.formatting.command == "nixpkgs-fmt") pkgs.nixpkgs-fmt;
|
||||
extraPackages = optional (cfg.settings.formatting.command == [ "nixpkgs-fmt" ]) pkgs.nixpkgs-fmt;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue