mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 11:02:37 +00:00 
			
		
		
		
	feat: make clang lsp install optional
This commit is contained in:
		
					parent
					
						
							
								ed09cb7ed6
							
						
					
				
			
			
				commit
				
					
						232d93024c
					
				
			
		
					 1 changed files with 7 additions and 3 deletions
				
			
		|  | @ -9,6 +9,10 @@ with builtins; let | ||||||
|   cfg = config.vim.languages.clang; |   cfg = config.vim.languages.clang; | ||||||
| 
 | 
 | ||||||
|   defaultServer = "ccls"; |   defaultServer = "ccls"; | ||||||
|  |   packageToCmd = package: defaultCmd: | ||||||
|  |     if isList cfg.lsp.package | ||||||
|  |     then nvim.lua.expToLua cfg.lsp.package | ||||||
|  |     else ''{ "${cfg.lsp.package}/bin/${defaultCmd}" }''; | ||||||
|   servers = { |   servers = { | ||||||
|     ccls = { |     ccls = { | ||||||
|       package = pkgs.ccls; |       package = pkgs.ccls; | ||||||
|  | @ -16,7 +20,7 @@ with builtins; let | ||||||
|         lspconfig.ccls.setup{ |         lspconfig.ccls.setup{ | ||||||
|           capabilities = capabilities; |           capabilities = capabilities; | ||||||
|           on_attach=default_on_attach; |           on_attach=default_on_attach; | ||||||
|           cmd = {"${cfg.lsp.package}/bin/ccls"}; |           cmd = ${packageToCmd cfg.lsp.package "ccls"}; | ||||||
|           ${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"} |           ${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"} | ||||||
|         } |         } | ||||||
|       ''; |       ''; | ||||||
|  | @ -30,7 +34,7 @@ with builtins; let | ||||||
|         lspconfig.clangd.setup{ |         lspconfig.clangd.setup{ | ||||||
|           capabilities = clangd_cap; |           capabilities = clangd_cap; | ||||||
|           on_attach=default_on_attach; |           on_attach=default_on_attach; | ||||||
|           cmd = {"${cfg.lsp.package}/bin/clangd"}; |           cmd = ${packageToCmd cfg.lsp.package "clangd"}; | ||||||
|           ${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"} |           ${optionalString (cfg.lsp.opts != null) "init_options = ${cfg.lsp.opts}"} | ||||||
|         } |         } | ||||||
|       ''; |       ''; | ||||||
|  | @ -95,7 +99,7 @@ in { | ||||||
| 
 | 
 | ||||||
|       package = mkOption { |       package = mkOption { | ||||||
|         description = "clang LSP server package"; |         description = "clang LSP server package"; | ||||||
|         type = types.package; |         type = with types; either package (listOf str); | ||||||
|         default = servers.${cfg.lsp.server}.package; |         default = servers.${cfg.lsp.server}.package; | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ching Pei Yang
				Ching Pei Yang