question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Launch a specific project with releaseMode in a workspace by hitting ctrl+shift+b

See original GitHub issue

Is your feature request related to a problem? Please describe. When There is only 1 project, with such launch.json (no tasks.json):

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "My_App",
            "request": "launch",
            "type": "dart",
            "cwd": "${workspaceFolder}",
        },
        {
            "name": "My_App(release mode)",
            "request": "launch",
            "type": "dart",
            "flutterMode": "release",
            "cwd": "${workspaceFolder}",
        }
    ]
}

The dart/flutter project can be run in debug mode with F5 and release mode with ctrl+shift+b. But if there are multiple projects in a workspace( some others may not be dart projects), though the specific dart project can be run in debug mode by hitting F5 with specifying the corresponding launch file in Run and Debug Explorer, it can’t be run in the release mode by hitting ctrl+shift+b— vscode would just run another project which has a complete tasks.json file.

Describe the solution you’d like I hope there is a command that could generate all acquired files (maybe the missing tasks.json?) for any dart/flutter project, in which specified at least debug and release tasks. So that even in a workspace, users can easily doing debug and release building by easily hitting F5 and ctrl+shift+b after choosing the specified launch file.

Describe alternatives you’ve considered I’ve tried to build tasks.json manually but failed. Because I don’t know how to add “device” in the command, be the Os is windows or Linux.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
dbsxdbsxcommented, Nov 15, 2022

@dbsxdbsx thanks for clarifying

When there is 1 flutter project with 1 rust project, I see this:

My understanding is that what’s happening here is VS Code functionality and not something Dart/Flutter can influence. In the first case (just Flutter project), you have no “build tasks” configured, so VS Code is asking all extensions for tasks, and then showing you a list of the results to see which to run.

In the second case with your first project, you have explicitly configured tasks and VS Code assumes you want to run those so it doesn’t present you with a list of Dart/Flutter tasks. This is not something that the Dart/Flutter extension can change - all we can do is provide tasks when VS Code asks for them, we do not control what happens when you press Ctrl+Shift+B.

I think the best thing you can do is create a keybinding for the standard “Run Task” command, which I think will prompt you always to select a task. I don’t think you can achieve what you want using the “Run Build Task” command (which is what Ctrl+Shift+B is bound to). Alternatively, you could create explicit tasks for the Flutter builds you want, and if they’re also marked as build tasks, VS Code will perhaps let you pick between those when you invoke the build task command.

Hope this makes sense!

Yes, both 2 approaches should be workable, and I prefer the latter approach. Thank you for your advice.

0reactions
DanTupcommented, Nov 16, 2022

Ah, perfect 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found