mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-02-28 14:04:29 +00:00
language/just: formatter
This commit is contained in:
parent
385c49d93d
commit
1af12636cd
2 changed files with 41 additions and 0 deletions
|
|
@ -144,3 +144,7 @@
|
|||
[Machshev](https://github.com/machshev):
|
||||
|
||||
- Added `ruff` and `ty` LSP support for Python under `programs.python`.
|
||||
|
||||
[Snoweuph](https://github.com/snoweuph)
|
||||
|
||||
- Added Formatting support to the `just` language through its builtin formatter.
|
||||
|
|
|
|||
|
|
@ -23,6 +23,18 @@
|
|||
root_markers = [".git" "justfile"];
|
||||
};
|
||||
};
|
||||
|
||||
defaultFormat = ["just"];
|
||||
|
||||
formats = {
|
||||
just = {
|
||||
command = getExe pkgs.just;
|
||||
args = [
|
||||
"--unstable"
|
||||
"--fmt"
|
||||
];
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.just = {
|
||||
enable = mkEnableOption "Just support";
|
||||
|
|
@ -42,6 +54,16 @@ in {
|
|||
description = "Just LSP server to use";
|
||||
};
|
||||
};
|
||||
|
||||
format = {
|
||||
enable = mkEnableOption "Justfile formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
description = "Justfile formatter to use";
|
||||
type = listOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
|
|
@ -60,5 +82,20 @@ in {
|
|||
})
|
||||
cfg.lsp.servers;
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
formatters_by_ft.just = cfg.format.type;
|
||||
formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue