mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 19:12:38 +00:00 
			
		
		
		
	move asm to new module type
This commit is contained in:
		
					parent
					
						
							
								21894cf58e
							
						
					
				
			
			
				commit
				
					
						8c8d250768
					
				
			
		
					 1 changed files with 25 additions and 15 deletions
				
			
		|  | @ -4,12 +4,24 @@ | ||||||
|   lib, |   lib, | ||||||
|   ... |   ... | ||||||
| }: let | }: let | ||||||
|  |   inherit (builtins) attrNames; | ||||||
|   inherit (lib.options) mkEnableOption mkOption; |   inherit (lib.options) mkEnableOption mkOption; | ||||||
|   inherit (lib.modules) mkIf mkMerge; |   inherit (lib.modules) mkIf mkMerge; | ||||||
|   inherit (lib.types) package; |   inherit (lib.types) package enum listOf; | ||||||
|   inherit (lib.nvim.types) mkGrammarOption; |   inherit (lib.nvim.types) mkGrammarOption; | ||||||
|  |   inherit (lib.meta) getExe; | ||||||
|  |   inherit (lib.nvim.attrsets) mapListToAttrs; | ||||||
| 
 | 
 | ||||||
|   cfg = config.vim.languages.assembly; |   cfg = config.vim.languages.assembly; | ||||||
|  |   defaultServers = ["asm-lsp"]; | ||||||
|  |   servers = { | ||||||
|  |     asm-lsp = { | ||||||
|  |       enable = true; | ||||||
|  |       cmd = [(getExe pkgs.asm-lsp)]; | ||||||
|  |       filetypes = ["asm" "vmasm"]; | ||||||
|  |       root_markers = [".asm-lsp.toml" ".git"]; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
| in { | in { | ||||||
|   options.vim.languages.assembly = { |   options.vim.languages.assembly = { | ||||||
|     enable = mkEnableOption "Assembly support"; |     enable = mkEnableOption "Assembly support"; | ||||||
|  | @ -20,12 +32,12 @@ in { | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     lsp = { |     lsp = { | ||||||
|       enable = mkEnableOption "Assembly LSP support (asm-lsp)" // {default = config.vim.lsp.enable;}; |       enable = mkEnableOption "Assembly LSP support" // {default = config.vim.lsp.enable;}; | ||||||
| 
 |       servers = mkOption { | ||||||
|       package = mkOption { |         description = "Assembly LSP server to use"; | ||||||
|         type = package; |         type = listOf (enum (attrNames servers)); | ||||||
|         default = pkgs.asm-lsp; |         default = defaultServers; | ||||||
|         description = "asm-lsp package"; |         example = ["asm-lsp"]; | ||||||
|       }; |       }; | ||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
|  | @ -36,14 +48,12 @@ in { | ||||||
|     }) |     }) | ||||||
| 
 | 
 | ||||||
|     (mkIf cfg.lsp.enable { |     (mkIf cfg.lsp.enable { | ||||||
|       vim.lsp.lspconfig.enable = true; |       vim.lsp.servers = | ||||||
|       vim.lsp.lspconfig.sources.asm-lsp = '' |         mapListToAttrs (n: { | ||||||
|         lspconfig.asm_lsp.setup { |           name = n; | ||||||
|           capabilities = capabilities, |           value = servers.${n}; | ||||||
|           on_attach = default_on_attach, |         }) | ||||||
|           cmd = {"${cfg.lsp.package}/bin/asm-lsp"}, |         cfg.lsp.servers; | ||||||
|         } |  | ||||||
|       ''; |  | ||||||
|     }) |     }) | ||||||
|   ]); |   ]); | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 sjcobb
				sjcobb