mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 11:02:37 +00:00 
			
		
		
		
	neovim/lsp: init
This commit is contained in:
		
					parent
					
						
							
								159a033902
							
						
					
				
			
			
				commit
				
					
						35c432db3b
					
				
			
		
					 2 changed files with 45 additions and 0 deletions
				
			
		|  | @ -5,6 +5,7 @@ | ||||||
|     ./debug.nix |     ./debug.nix | ||||||
|     ./diagnostics.nix |     ./diagnostics.nix | ||||||
|     ./highlight.nix |     ./highlight.nix | ||||||
|  |     ./lsp.nix | ||||||
|     ./spellcheck.nix |     ./spellcheck.nix | ||||||
|   ]; |   ]; | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										44
									
								
								modules/neovim/init/lsp.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								modules/neovim/init/lsp.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,44 @@ | ||||||
|  | { | ||||||
|  |   config, | ||||||
|  |   lib, | ||||||
|  |   ... | ||||||
|  | }: let | ||||||
|  |   inherit (lib.modules) mkIf; | ||||||
|  |   inherit (lib.options) mkOption; | ||||||
|  |   inherit (lib.types) attrsOf; | ||||||
|  |   inherit (lib.strings) concatLines; | ||||||
|  |   inherit (lib.attrsets) mapAttrsToList attrNames filterAttrs; | ||||||
|  |   inherit (lib.nvim.languages) lspOptions; | ||||||
|  |   inherit (lib.nvim.dag) entryAnywhere; | ||||||
|  |   inherit (lib.nvim.lua) toLuaObject; | ||||||
|  | 
 | ||||||
|  |   cfg = config.vim.lsp; | ||||||
|  | 
 | ||||||
|  |   lspConfigurations = | ||||||
|  |     mapAttrsToList ( | ||||||
|  |       name: value: '' | ||||||
|  |         vim.lsp.config["${name}"] = ${toLuaObject value} | ||||||
|  |       '' | ||||||
|  |     ) | ||||||
|  |     cfg.servers; | ||||||
|  | 
 | ||||||
|  |   enabledServers = filterAttrs (_: u: u.enable) cfg.servers; | ||||||
|  | in { | ||||||
|  |   options = { | ||||||
|  |     vim.lsp.servers = mkOption { | ||||||
|  |       type = attrsOf lspOptions; | ||||||
|  |       default = {}; | ||||||
|  |       description = ""; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   config = mkIf (cfg.servers != {}) { | ||||||
|  |     vim.luaConfigRC.lsp-servers = entryAnywhere '' | ||||||
|  |       -- Individual LSP configurations managed by nvf. | ||||||
|  |       ${(concatLines lspConfigurations)} | ||||||
|  | 
 | ||||||
|  |       -- Enable configured LSPs explicitly | ||||||
|  |       vim.lsp.enable(${toLuaObject (attrNames enabledServers)}) | ||||||
|  |     ''; | ||||||
|  |   }; | ||||||
|  | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ching Pei Yang
					Ching Pei Yang