mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2026-05-11 07:18:04 +02:00
Merge 7b97a223c1 into e86a92e4b2
This commit is contained in:
commit
17db12e9fb
2 changed files with 76 additions and 4 deletions
|
|
@ -388,6 +388,8 @@
|
|||
|
||||
- Fix `languages.ts` registration of formatters.
|
||||
|
||||
- Added `asmfmt` and `nasmfmt` formatters to `languages.asm`.
|
||||
|
||||
- Added `biome-check` and `biome-organize-imports` formatters to `languages.ts`.
|
||||
|
||||
- Added [`biomejs`](https://biomejs.dev/) as extra diagnostics provider to
|
||||
|
|
|
|||
|
|
@ -4,15 +4,37 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) enum listOf;
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) genAttrs;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||
inherit (lib.types) enum listOf;
|
||||
|
||||
cfg = config.vim.languages.assembly;
|
||||
defaultServers = ["asm-lsp"];
|
||||
servers = ["asm-lsp"];
|
||||
|
||||
defaultFormat = ["asmfmt"];
|
||||
formats = {
|
||||
asmfmt = {
|
||||
command = getExe pkgs.asmfmt;
|
||||
};
|
||||
nasmfmt = {
|
||||
command = getExe pkgs.nasmfmt;
|
||||
args = mkLuaInline ''
|
||||
function(self, ctx)
|
||||
return {
|
||||
"--ii", ctx.shiftwidth,
|
||||
"$FILENAME",
|
||||
}
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.languages.assembly = {
|
||||
enable = mkEnableOption "Assembly support";
|
||||
|
|
@ -42,6 +64,20 @@ in {
|
|||
description = "Assembly LSP server to use";
|
||||
};
|
||||
};
|
||||
|
||||
format = {
|
||||
enable =
|
||||
mkEnableOption "Assembly formatting"
|
||||
// {
|
||||
default = config.vim.languages.enableFormat;
|
||||
defaultText = literalExpression "config.vim.languages.enableFormat";
|
||||
};
|
||||
type = mkOption {
|
||||
type = listOf (enum (attrNames formats));
|
||||
default = defaultFormat;
|
||||
description = "Assembly formatter to use";
|
||||
};
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
|
|
@ -57,9 +93,43 @@ in {
|
|||
vim.lsp = {
|
||||
presets = genAttrs cfg.lsp.servers (_: {enable = true;});
|
||||
servers = genAttrs cfg.lsp.servers (_: {
|
||||
filetypes = ["asm" "nasm" "masm" "vmasm" "fasm" "tasm" "tiasm" "asm68k" "asm8300"];
|
||||
filetypes = [
|
||||
"asm"
|
||||
"nasm"
|
||||
"masm"
|
||||
"vmasm"
|
||||
"fasm"
|
||||
"tasm"
|
||||
"tiasm"
|
||||
"asm68k"
|
||||
"asmh8300"
|
||||
];
|
||||
});
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
formatters_by_ft = {
|
||||
asm = cfg.format.type;
|
||||
nasm = cfg.format.type;
|
||||
masm = cfg.format.type;
|
||||
vmasm = cfg.format.type;
|
||||
tasm = cfg.format.type;
|
||||
tiasm = cfg.format.type;
|
||||
asm68k = cfg.format.type;
|
||||
asmh8300 = cfg.format.type;
|
||||
};
|
||||
formatters =
|
||||
mapListToAttrs (name: {
|
||||
inherit name;
|
||||
value = formats.${name};
|
||||
})
|
||||
cfg.format.type;
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue