mirror of
				https://github.com/NotAShelf/nvf.git
				synced 2025-10-31 19:12:38 +00:00 
			
		
		
		
	feat: option to autostart debugger UI
This commit is contained in:
		
					parent
					
						
							
								640e37bd08
							
						
					
				
			
			
				commit
				
					
						595e76ed2f
					
				
			
		
					 2 changed files with 32 additions and 12 deletions
				
			
		|  | @ -7,17 +7,32 @@ with lib; | ||||||
| with builtins; let | with builtins; let | ||||||
|   cfg = config.vim.debugger.nvim-dap; |   cfg = config.vim.debugger.nvim-dap; | ||||||
| in { | in { | ||||||
|   config = mkIf cfg.enable { |   config = mkMerge [ | ||||||
|     vim.startPlugins = |     (mkIf cfg.enable { | ||||||
|       [ |       vim.startPlugins = ["nvim-dap"]; | ||||||
|         "nvim-dap" |  | ||||||
|       ] |  | ||||||
|       ++ optionals cfg.ui.enable [ |  | ||||||
|         "nvim-dap-ui" |  | ||||||
|       ]; |  | ||||||
| 
 | 
 | ||||||
|     vim.luaConfigRC.nvim-dap-ui = nvim.dag.entryAnywhere '' |       vim.luaConfigRC.nvim-dap = | ||||||
|       require("dapui").setup() |         nvim.dag.entryAnywhere '' | ||||||
|         ''; |         ''; | ||||||
|   }; |     }) | ||||||
|  |     (mkIf (cfg.enable && cfg.ui.enable) { | ||||||
|  |       vim.startPlugins = ["nvim-dap-ui"]; | ||||||
|  | 
 | ||||||
|  |       vim.luaConfigRC.nvim-dap-ui = nvim.dag.entryAfter ["nvim-dap"] ('' | ||||||
|  |           local dapui = require("dapui") | ||||||
|  |           require("dapui").setup() | ||||||
|  |         '' | ||||||
|  |         + optionalString cfg.ui.autoStart '' | ||||||
|  |           dap.listeners.after.event_initialized["dapui_config"] = function() | ||||||
|  |             dapui.open() | ||||||
|  |           end | ||||||
|  |           dap.listeners.before.event_terminated["dapui_config"] = function() | ||||||
|  |             dapui.close() | ||||||
|  |           end | ||||||
|  |           dap.listeners.before.event_exited["dapui_config"] = function() | ||||||
|  |             dapui.close() | ||||||
|  |           end | ||||||
|  |         ''); | ||||||
|  |     }) | ||||||
|  |   ]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -5,6 +5,11 @@ with lib; { | ||||||
| 
 | 
 | ||||||
|     ui = { |     ui = { | ||||||
|       enable = mkEnableOption "Enable UI extension for nvim-dap"; |       enable = mkEnableOption "Enable UI extension for nvim-dap"; | ||||||
|  |       autoStart = mkOption { | ||||||
|  |         type = types.bool; | ||||||
|  |         default = true; | ||||||
|  |         description = "Automatically Opens and Closes DAP-UI upon starting/closing a debugging session"; | ||||||
|  |       }; | ||||||
|     }; |     }; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ching Pei Yang
				Ching Pei Yang