mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 19:12:38 +00:00 
			
		
		
		
	internal: add customizable plugin setup option
This commit is contained in:
		
					parent
					
						
							
								a35eab716a
							
						
					
				
			
			
				commit
				
					
						59b2e6b17c
					
				
			
		
					 2 changed files with 22 additions and 1 deletions
				
			
		|  | @ -4,6 +4,6 @@ | ||||||
|   typesLanguage = import ./languages.nix {inherit lib;}; |   typesLanguage = import ./languages.nix {inherit lib;}; | ||||||
| in { | in { | ||||||
|   inherit (typesDag) dagOf; |   inherit (typesDag) dagOf; | ||||||
|   inherit (typesPlugin) pluginsOpt extraPluginType; |   inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption; | ||||||
|   inherit (typesLanguage) diagnostics mkGrammarOption; |   inherit (typesLanguage) diagnostics mkGrammarOption; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -138,4 +138,25 @@ in { | ||||||
|       inherit description default; |       inherit description default; | ||||||
|       type = pluginsType; |       type = pluginsType; | ||||||
|     }; |     }; | ||||||
|  | 
 | ||||||
|  |   # opts is a attrset of options, example: | ||||||
|  |   # ``` | ||||||
|  |   # mkPluginSetupOption "telescope" { | ||||||
|  |   #   file_ignore_patterns = mkOption { | ||||||
|  |   #     description = "..."; | ||||||
|  |   #     type = types.listOf types.str; | ||||||
|  |   #     default = []; | ||||||
|  |   #   }; | ||||||
|  |   #   layout_config.horizontal = mkOption {...}; | ||||||
|  |   # } | ||||||
|  |   # ``` | ||||||
|  |   mkPluginSetupOption = pluginName: opts: | ||||||
|  |     mkOption { | ||||||
|  |       description = "Option table to pass into the setup function of " + pluginName; | ||||||
|  |       default = {}; | ||||||
|  |       type = types.submodule { | ||||||
|  |         freeformType = with types; attrsOf anything; | ||||||
|  |         options = opts; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ching Pei Yang
				Ching Pei Yang