mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-25 18:28:37 +02:00
plugins/package-info: init
This commit is contained in:
parent
04ad7937c0
commit
d4b1827606
2 changed files with 139 additions and 0 deletions
108
plugins/by-name/package-info/default.nix
Normal file
108
plugins/by-name/package-info/default.nix
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
in
|
||||||
|
lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
||||||
|
name = "package-info";
|
||||||
|
originalName = "package-info.nvim";
|
||||||
|
package = "package-info-nvim";
|
||||||
|
|
||||||
|
maintainers = [ lib.maintainers.khaneliman ];
|
||||||
|
|
||||||
|
settingsOptions = {
|
||||||
|
autostart = defaultNullOpts.mkBool true ''
|
||||||
|
Whether to autostart when `package.json` is opened.
|
||||||
|
'';
|
||||||
|
|
||||||
|
hide_up_to_date = defaultNullOpts.mkBool false ''
|
||||||
|
It hides up to date versions when displaying virtual text.
|
||||||
|
'';
|
||||||
|
|
||||||
|
hide_unstable_versions = defaultNullOpts.mkBool false ''
|
||||||
|
It hides unstable versions from version list e.g `next-11.1.3-canary3`.
|
||||||
|
'';
|
||||||
|
|
||||||
|
package_manager = defaultNullOpts.mkStr "npm" ''
|
||||||
|
Can be `npm`, `yarn`, or `pnpm`.
|
||||||
|
|
||||||
|
The plugin will try to auto-detect the package manager based on
|
||||||
|
`yarn.lock` or `package-lock.json`.
|
||||||
|
|
||||||
|
If none are found it will use the provided one, if nothing is provided it will use `npm`
|
||||||
|
'';
|
||||||
|
|
||||||
|
colors =
|
||||||
|
defaultNullOpts.mkNullableWithRaw
|
||||||
|
(
|
||||||
|
with lib.types;
|
||||||
|
submodule {
|
||||||
|
freeformType = with types; attrsOf anything;
|
||||||
|
options = {
|
||||||
|
up_to_date = defaultNullOpts.mkStr "#3C4048" ''
|
||||||
|
Text color for up to date dependency virtual text.
|
||||||
|
'';
|
||||||
|
outdated = defaultNullOpts.mkStr "#d19a66" ''
|
||||||
|
Text color for outdated dependency virtual text.
|
||||||
|
'';
|
||||||
|
invalid = defaultNullOpts.mkStr "#ee4b2b" ''
|
||||||
|
Text color for invalid dependency virtual text.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
up_to_date = "#3C4048";
|
||||||
|
outdated = "#d19a66";
|
||||||
|
invalid = "#ee4b2b";
|
||||||
|
}
|
||||||
|
"Colors of virtual text.";
|
||||||
|
|
||||||
|
icons =
|
||||||
|
defaultNullOpts.mkNullableWithRaw
|
||||||
|
(
|
||||||
|
with lib.types;
|
||||||
|
either anything (submodule {
|
||||||
|
freeformType = with types; attrsOf anything;
|
||||||
|
options = {
|
||||||
|
enable = defaultNullOpts.mkBool true ''
|
||||||
|
Whether to display icons.
|
||||||
|
'';
|
||||||
|
style = defaultNullOpts.mkAttrsOf anything {
|
||||||
|
up_to_date = "| ";
|
||||||
|
outdated = "| ";
|
||||||
|
invalid = "| ";
|
||||||
|
} "Icons for different dependency states.";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
)
|
||||||
|
{
|
||||||
|
enable = true;
|
||||||
|
style = {
|
||||||
|
up_to_date = "| ";
|
||||||
|
outdated = "| ";
|
||||||
|
invalid = "| ";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
"Icons for virtual text.";
|
||||||
|
};
|
||||||
|
|
||||||
|
extraOptions = {
|
||||||
|
packageManagerPackage =
|
||||||
|
lib.mkPackageOption pkgs
|
||||||
|
[
|
||||||
|
"nodePackages"
|
||||||
|
"npm"
|
||||||
|
]
|
||||||
|
{
|
||||||
|
nullable = true;
|
||||||
|
default = null;
|
||||||
|
example = "pkgs.nodePackages.npm";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
extraConfig = cfg: { extraPackages = [ cfg.packageManagerPackage ]; };
|
||||||
|
}
|
31
tests/test-sources/plugins/by-name/package-info/default.nix
Normal file
31
tests/test-sources/plugins/by-name/package-info/default.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
empty = {
|
||||||
|
plugins.package-info.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
default = {
|
||||||
|
plugins.package-info = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
colors = {
|
||||||
|
up_to_date = "#3C4048";
|
||||||
|
outdated = "#d19a66";
|
||||||
|
invalid = "#ee4b2b";
|
||||||
|
};
|
||||||
|
icons = {
|
||||||
|
enable = true;
|
||||||
|
style = {
|
||||||
|
up_to_date = "| ";
|
||||||
|
outdated = "| ";
|
||||||
|
invalid = "| ";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
autostart = true;
|
||||||
|
package_manager = "npm";
|
||||||
|
hide_up_to_date = false;
|
||||||
|
hide_unstable_versions = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue