languages/assembly: init (#447)

* asm: init

* docs: added changelog for assembly

* asm: fixing requested changes

* configuration: assembly set to false
This commit is contained in:
Soliprem 2024-11-09 21:13:27 +01:00 committed by GitHub
parent dfdad4c2ce
commit 1604c7423f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 53 additions and 0 deletions

View file

@ -46,6 +46,8 @@ isMaximal: {
nix.enable = true;
# Assembly is not common, and the asm LSP is a major hit-or-miss
assembly.enable = false;
markdown.enable = isMaximal;
html.enable = isMaximal;
css.enable = isMaximal;

View file

@ -307,6 +307,7 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to
- Add LSP, formatter and Treesitter support for Vala under `vim.languages.vala`
- Add [Tinymist](https://github.com/Myriad-Dreamin/tinymist] as a formatter for
the Typst language module.
- Add LSP and Treesitter support for Assembly under `vim.languages.assembly`
[Bloxx12](https://github.com/Bloxx12)

View file

@ -0,0 +1,49 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.types) package;
inherit (lib.nvim.types) mkGrammarOption;
cfg = config.vim.languages.assembly;
in {
options.vim.languages.assembly = {
enable = mkEnableOption "Assembly support";
treesitter = {
enable = mkEnableOption "Assembly treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "asm";
};
lsp = {
enable = mkEnableOption "Assembly LSP support (asm-lsp)" // {default = config.vim.languages.enableLSP;};
package = mkOption {
type = package;
default = pkgs.asm-lsp;
description = "asm-lsp package";
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.package];
})
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.asm-lsp = ''
lspconfig.asm_lsp.setup {
capabilities = capabilities,
on_attach = default_on_attach,
cmd = {"${cfg.lsp.package}/bin/asm-lsp"},
}
'';
})
]);
}

View file

@ -2,6 +2,7 @@
inherit (lib.nvim.languages) mkEnable;
in {
imports = [
./asm.nix
./bash.nix
./dart.nix
./clang.nix