mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-25 17:06:11 +00:00 
			
		
		
		
	Merge pull request #38 from NotAShelf/flutter-tools.nvim
Feature/flutter-tools.nvim
This commit is contained in:
		
				commit
				
					
						7590bdf0ad
					
				
			
		
					 9 changed files with 128 additions and 21 deletions
				
			
		
							
								
								
									
										17
									
								
								flake.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										17
									
								
								flake.lock
									
										
									
										generated
									
									
									
								
							|  | @ -256,6 +256,22 @@ | ||||||
|         "type": "github" |         "type": "github" | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|  |     "dart-tools": { | ||||||
|  |       "flake": false, | ||||||
|  |       "locked": { | ||||||
|  |         "lastModified": 1680456818, | ||||||
|  |         "narHash": "sha256-VNSrYJZKcQ92+2ko5ZkOOiAM/sXqbJtpkYvxFr1qtWk=", | ||||||
|  |         "owner": "akinsho", | ||||||
|  |         "repo": "flutter-tools.nvim", | ||||||
|  |         "rev": "0a7e6b40aebd874e957ed630420a267e6cac0967", | ||||||
|  |         "type": "github" | ||||||
|  |       }, | ||||||
|  |       "original": { | ||||||
|  |         "owner": "akinsho", | ||||||
|  |         "repo": "flutter-tools.nvim", | ||||||
|  |         "type": "github" | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|     "dashboard-nvim": { |     "dashboard-nvim": { | ||||||
|       "flake": false, |       "flake": false, | ||||||
|       "locked": { |       "locked": { | ||||||
|  | @ -1236,6 +1252,7 @@ | ||||||
|         "comment-nvim": "comment-nvim", |         "comment-nvim": "comment-nvim", | ||||||
|         "copilot-lua": "copilot-lua", |         "copilot-lua": "copilot-lua", | ||||||
|         "crates-nvim": "crates-nvim", |         "crates-nvim": "crates-nvim", | ||||||
|  |         "dart-tools": "dart-tools", | ||||||
|         "dashboard-nvim": "dashboard-nvim", |         "dashboard-nvim": "dashboard-nvim", | ||||||
|         "diffview-nvim": "diffview-nvim", |         "diffview-nvim": "diffview-nvim", | ||||||
|         "dressing-nvim": "dressing-nvim", |         "dressing-nvim": "dressing-nvim", | ||||||
|  |  | ||||||
|  | @ -135,6 +135,11 @@ | ||||||
|       flake = false; |       flake = false; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  |     flutter-tools = { | ||||||
|  |       url = "github:akinsho/flutter-tools.nvim"; | ||||||
|  |       flake = false; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|     # Copying/Registers |     # Copying/Registers | ||||||
|     registers = { |     registers = { | ||||||
|       url = "github:tversteeg/registers.nvim"; |       url = "github:tversteeg/registers.nvim"; | ||||||
|  |  | ||||||
|  | @ -72,6 +72,7 @@ with lib; let | ||||||
|     "fidget-nvim" |     "fidget-nvim" | ||||||
|     "diffview-nvim" |     "diffview-nvim" | ||||||
|     "todo-comments" |     "todo-comments" | ||||||
|  |     "flutter-tools" | ||||||
|   ]; |   ]; | ||||||
|   # You can either use the name of the plugin or a package. |   # You can either use the name of the plugin or a package. | ||||||
|   pluginsType = with types; listOf (nullOr (either (enum availablePlugins) package)); |   pluginsType = with types; listOf (nullOr (either (enum availablePlugins) package)); | ||||||
|  |  | ||||||
|  | @ -10,5 +10,8 @@ | ||||||
|     ./trouble |     ./trouble | ||||||
|     ./lsp-signature |     ./lsp-signature | ||||||
|     ./lightbulb |     ./lightbulb | ||||||
|  | 
 | ||||||
|  |     # flutter-tools | ||||||
|  |     ./flutter-tools-nvim | ||||||
|   ]; |   ]; | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										33
									
								
								modules/lsp/flutter-tools-nvim/config.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								modules/lsp/flutter-tools-nvim/config.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,33 @@ | ||||||
|  | { | ||||||
|  |   config, | ||||||
|  |   lib, | ||||||
|  |   ... | ||||||
|  | }: | ||||||
|  | with lib; | ||||||
|  | with builtins; let | ||||||
|  |   cfg = config.vim.lsp; | ||||||
|  |   ftcfg = cfg.dart.flutter-tools; | ||||||
|  | in { | ||||||
|  |   config = mkIf (cfg.enable && ftcfg.enable) { | ||||||
|  |     vim.startPlugins = ["flutter-tools"]; | ||||||
|  | 
 | ||||||
|  |     vim.luaConfigRC.flutter-tools = nvim.dag.entryAnywhere '' | ||||||
|  |       require('flutter-tools').setup { | ||||||
|  |         lsp = { | ||||||
|  |           color = { -- show the derived colours for dart variables | ||||||
|  |             enabled = ${boolToString ftcfg.color.enable}, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10 | ||||||
|  |             background = ${boolToString ftcfg.color.highlightBackground}, -- highlight the background | ||||||
|  |             foreground = ${boolToString ftcfg.color.highlightForeground}, -- highlight the foreground | ||||||
|  |             virtual_text = ${boolToString ftcfg.color.virtualText.enable}, -- show the highlight using virtual text | ||||||
|  |             virtual_text_str = ${ftcfg.color.virtualText.character} -- the virtual text character to highlight | ||||||
|  |           }, | ||||||
|  | 
 | ||||||
|  |           capabilities = capabilities, | ||||||
|  |           on_attach = default_on_attach; | ||||||
|  |           flags = lsp_flags, | ||||||
|  |         }, | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |     ''; | ||||||
|  |   }; | ||||||
|  | } | ||||||
							
								
								
									
										6
									
								
								modules/lsp/flutter-tools-nvim/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								modules/lsp/flutter-tools-nvim/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | ||||||
|  | _: { | ||||||
|  |   imports = [ | ||||||
|  |     ./flutter-tools.nix | ||||||
|  |     ./config.nix | ||||||
|  |   ]; | ||||||
|  | } | ||||||
							
								
								
									
										35
									
								
								modules/lsp/flutter-tools-nvim/flutter-tools.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								modules/lsp/flutter-tools-nvim/flutter-tools.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | ||||||
|  | { | ||||||
|  |   config, | ||||||
|  |   lib, | ||||||
|  |   ... | ||||||
|  | }: | ||||||
|  | with lib; | ||||||
|  | with builtins; { | ||||||
|  |   options.vim.lsp.dart.flutter-tools = { | ||||||
|  |     color = { | ||||||
|  |       enable = mkEnableOption "Whether or mot to highlight color variables at all"; | ||||||
|  | 
 | ||||||
|  |       highlightBackground = mkOption { | ||||||
|  |         type = types.bool; | ||||||
|  |         default = false; | ||||||
|  |         description = "Highlight the background"; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       highlightForeground = mkOption { | ||||||
|  |         type = types.bool; | ||||||
|  |         default = false; | ||||||
|  |         description = "Highlight the foreground"; | ||||||
|  |       }; | ||||||
|  | 
 | ||||||
|  |       virtualText = { | ||||||
|  |         enable = mkEnableOption "Show the highlight using virtual text"; | ||||||
|  | 
 | ||||||
|  |         character = mkOption { | ||||||
|  |           type = types.str; | ||||||
|  |           default = "■"; | ||||||
|  |           description = "Virtual text character to highlight"; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |   }; | ||||||
|  | } | ||||||
|  | @ -57,6 +57,13 @@ in { | ||||||
|         default = ""; |         default = ""; | ||||||
|       }; |       }; | ||||||
|     }; |     }; | ||||||
|  | 
 | ||||||
|  |     dart = { | ||||||
|  |       flutter-tools = { | ||||||
|  |         enable = mkEnableOption ""; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|     sql = mkEnableOption "SQL Language LSP"; |     sql = mkEnableOption "SQL Language LSP"; | ||||||
|     go = mkEnableOption "Go language LSP"; |     go = mkEnableOption "Go language LSP"; | ||||||
|     ts = mkEnableOption "TS language LSP"; |     ts = mkEnableOption "TS language LSP"; | ||||||
|  |  | ||||||
|  | @ -12,17 +12,16 @@ in { | ||||||
| 
 | 
 | ||||||
|     vim.luaConfigRC.whichkey = nvim.dag.entryAnywhere '' |     vim.luaConfigRC.whichkey = nvim.dag.entryAnywhere '' | ||||||
|       local wk = require("which-key") |       local wk = require("which-key") | ||||||
|        wk.setup {} |       wk.setup ({ | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|        wk.register({ |  | ||||||
|         key_labels = { |         key_labels = { | ||||||
|           ["<space>"] = "SPACE", |           ["<space>"] = "SPACE", | ||||||
|           ["<leader>"] = "SPACE", |           ["<leader>"] = "SPACE", | ||||||
|           ["<cr>"] = "RETURN", |           ["<cr>"] = "RETURN", | ||||||
|           ["<tab>"] = "TAB", |           ["<tab>"] = "TAB", | ||||||
|       }, |         } | ||||||
|  |       }) | ||||||
| 
 | 
 | ||||||
|  |       wk.register({ | ||||||
|         ${ |         ${ | ||||||
|         if config.vim.tabline.nvimBufferline.enable |         if config.vim.tabline.nvimBufferline.enable | ||||||
|         then '' |         then '' | ||||||
|  | @ -31,7 +30,6 @@ in { | ||||||
|           ["<leader>bm"] = { name = "BufferLineMove" }, |           ["<leader>bm"] = { name = "BufferLineMove" }, | ||||||
|           ["<leader>bs"] = { name = "BufferLineSort" }, |           ["<leader>bs"] = { name = "BufferLineSort" }, | ||||||
|           ["<leader>bsi"] = { name = "BufferLineSortById" }, |           ["<leader>bsi"] = { name = "BufferLineSortById" }, | ||||||
| 
 |  | ||||||
|         '' |         '' | ||||||
|         else "" |         else "" | ||||||
|       } |       } | ||||||
|  | @ -106,6 +104,7 @@ in { | ||||||
|         '' |         '' | ||||||
|         else "" |         else "" | ||||||
|       } |       } | ||||||
|  | 
 | ||||||
|         ${ |         ${ | ||||||
|         if config.vim.markdown.glow.enable |         if config.vim.markdown.glow.enable | ||||||
|         then '' |         then '' | ||||||
|  | @ -114,6 +113,7 @@ in { | ||||||
|         '' |         '' | ||||||
|         else "" |         else "" | ||||||
|       } |       } | ||||||
|  | 
 | ||||||
|       }) |       }) | ||||||
|     ''; |     ''; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 NotAShelf
				NotAShelf