From c10b73823043e0c13d9993f5f4638b788a2fdeb1 Mon Sep 17 00:00:00 2001 From: Anup Sebastian <56888132+anupjsebastian@users.noreply.github.com> Date: Thu, 30 Oct 2025 07:50:59 -0500 Subject: [PATCH] fix: flutter dap resizing fix, buffer modifiable fix --- lua/custom/plugins/flutter.lua | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/lua/custom/plugins/flutter.lua b/lua/custom/plugins/flutter.lua index 0d94dbfa..87af83f5 100644 --- a/lua/custom/plugins/flutter.lua +++ b/lua/custom/plugins/flutter.lua @@ -108,7 +108,9 @@ return { dev_log = { enabled = true, + notify_errors = false, -- Don't show error notifications for log buffer issues open_cmd = 'tabedit', -- Open logs in a new tab + focus_on_open = false, -- Don't auto-focus the log window }, debugger = { @@ -140,13 +142,61 @@ return { disconnect = '⏏', }, }, + -- Fix layout to prevent resizing issues with Neo-tree + layouts = { + { + elements = { + { id = 'scopes', size = 0.25 }, + { id = 'breakpoints', size = 0.25 }, + { id = 'stacks', size = 0.25 }, + { id = 'watches', size = 0.25 }, + }, + size = 40, -- Fixed width instead of percentage + position = 'right', -- Changed to right to avoid conflict with Neo-tree on left + }, + { + elements = { + { id = 'repl', size = 0.5 }, + { id = 'console', size = 0.5 }, + }, + size = 10, -- Fixed height + position = 'bottom', + }, + }, } -- Automatically open/close DAP UI + -- Don't close Neo-tree, they can coexist now (DAP on right, Neo-tree on left) dap.listeners.after.event_initialized['dapui_config'] = dapui.open dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close + -- Fix for Flutter Tools log buffer becoming non-modifiable + -- This catches all buffer types that might be used for Flutter logs + vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, { + pattern = '*', + callback = function(args) + local bufname = vim.api.nvim_buf_get_name(args.buf) + -- Check if this is a Flutter log buffer + if bufname:match('__FLUTTER_DEV_LOG__') or vim.bo[args.buf].filetype == 'log' then + vim.bo[args.buf].modifiable = true + vim.bo[args.buf].readonly = false + vim.bo[args.buf].buftype = '' -- Make it a normal buffer + end + end, + }) + + -- Also fix it whenever Flutter tries to write to the log + vim.api.nvim_create_autocmd('BufModifiedSet', { + pattern = '*', + callback = function(args) + local bufname = vim.api.nvim_buf_get_name(args.buf) + if bufname:match('__FLUTTER_DEV_LOG__') then + vim.bo[args.buf].modifiable = true + end + end, + }) + -- ======================================================================== -- FLUTTER-SPECIFIC KEYMAPS -- ========================================================================