mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 13:20:44 +00:00
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:
parent
dfdad4c2ce
commit
1604c7423f
4 changed files with 53 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
49
modules/plugins/languages/asm.nix
Normal file
49
modules/plugins/languages/asm.nix
Normal 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"},
|
||||
}
|
||||
'';
|
||||
})
|
||||
]);
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
inherit (lib.nvim.languages) mkEnable;
|
||||
in {
|
||||
imports = [
|
||||
./asm.nix
|
||||
./bash.nix
|
||||
./dart.nix
|
||||
./clang.nix
|
||||
|
|
Loading…
Reference in a new issue