Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] FlutterRun attaches debugger #443

Open
1 task done
paulwyszynski opened this issue Feb 16, 2025 · 2 comments
Open
1 task done

[BUG] FlutterRun attaches debugger #443

paulwyszynski opened this issue Feb 16, 2025 · 2 comments

Comments

@paulwyszynski
Copy link

paulwyszynski commented Feb 16, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Hi! Nice Plugin.

I've noticed that the debugger is attached when running FlutterRun (with debugger enabled in my config) and also the dap windows are visible. Is that the intended behavior? There's also a FlutterDebug command.

Expected Behavior

Running FlutterRun should not attach debugger
Running FlutterDebug should start the debugger

Steps To Reproduce

  1. MacOSX 15.3
  2. Flutter version:
Flutter 3.29.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 35c388afb5 (5 days ago) • 2025-02-10 12:48:41 -0800
Engine • revision f73bfc4522
Tools • Dart 3.7.0 • DevTools 2.42.2
  1. Flutter is in path
  2. Neovim version: 0.10.4
  3. Config
return {
  "nvim-flutter/flutter-tools.nvim",
  lazy = false,
  ft = "dart",
  dependencies = {
    "nvim-lua/plenary.nvim",
    "stevearc/dressing.nvim", --optional for vim.ui.select
  },
  config = true,
  opts = {
    flutter_path = "/opt/homebrew/bin/flutter",
    debugger = {
      enabled = true,
    },
    lsp = {
      on_attach = function(client, bufnr)
        if client.name == "dartls" then
          vim.api.nvim_buf_set_keymap(
            bufnr,
            "n",
            "<leader>cx",
            "<cmd>Telescope flutter commands<CR>",
            { desc = "Flutter" }
          )
        end
      end,
    },
  },
}

@sidlatau
Copy link
Collaborator

Although it may seem strange, this behavior is intentional. FlutterDebug was added recently, but to avoid breaking existing users, the old behavior was left unchanged. This means that FlutterRun responds to the debugger.enabled flag: if it is set to true, it runs in debug mode.

In contrast, FlutterDebug does not respond to this flag — it always attaches DAP. If you do not want FlutterRun to attach DAP, you can set debugger.enabled to false.

There was a small error that prevented FlutterDebug from starting in debug mode, but that should now be fixed.

@paulwyszynski
Copy link
Author

Ok thanks, this makes sense. I had actually some issues with starting the debugger with <space>dc for run/continue debugger (default nvim-dap keymappings). I had to start the first debug session with the FlutterDebug command, after that I could start new sessions with <space>dc where the configuration window (launch/connect flutter) also popped up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants