Conversation
|
@IgorKhramtsov are you using a debugger? Looks like I can make it work if I disable the debugger in settings: debugger = {
enabled = false,
run_via_dap = false
},
But if the debugger is enabled it does not work. I guess some changes need to be done there: |
|
Hey, @sidlatau! Yes, I use the debugger and now when I tried to launch a flutter app without it, I found out this fix doesn't work, so I need to think on it more. Regarding the issue - it doesn't work for me without the debugger. Here are the steps:
Previously, when I used vscode, I had the following launch.json config: {
"name": "Launch example",
"request": "launch",
"type": "dart",
"program": "packages/example/lib/main.dart"
},And when I execute it I can see that vscode internally resolves this path and use You say it works for you; do you make something different, am I missing something? For the case with the debugger, it turned out I'm able to run it without changes from this PR. I have the following dap configuration applied for my project: dap.configurations.dart = {
{
type = "flutter",
request = "launch",
name = "Launch flutter",
dartSdkPath = paths.dart_sdk,
flutterSdkPath = paths.flutter_sdk,
program = "lib/main.dart",
cwd = "${workspaceFolder}/packages/example",
}
}I'm not sure how dap determines |
|
Added the same functionality via #482 |
In my project, we are using monorepo, so the project structure looks like this:
With such a structure, in order to be able to run
exampleapp from any other package, you need to addmelos.yamltoroot_patterns. After that, if you try to run the flutter app by specifying targetpackages/example/lib/main.dart, you will get an error "this project is not configured for x (macos/chrome/etc.)" . This happens becausefluttercommand is run from thelsp.get_lsp_root_dir(), which isflutter-monorepo.I checked how vscode behaves in such situation, and when you specify
packages/example/lib/main.dartas a target inlaunch.jsonwithout explicitly specifying thecwd- looks like it will internally check that the flutter package root (packages/example) is different from the whole project root (flutter-monorepo) and changes the target to be relative to that package.