Skip to content

"Dart: Dev Tools Browser" should be clearly documented as only working for local workspaces #5431

Closed

Description

@mkorbel1

Describe the bug
Split off from flutter/devtools#8912 (see flutter/devtools#8912 (comment))

If you open devtools in the browser while debugging in Dart in VS Code in WSL, the "Dart: Dev Tools Browser" setting does not seem to take effect. Whether it is set to "chrome" or "default", it always opens in "default", which is Edge on my system. Note that this only is an issue for me in WSL, and the setting works appropriately in Windows natively.

To Reproduce

  1. Set default browser on your system to Edge (or something else non-Chrome)
  2. Open VS Code in WSL2 Ubuntu
  3. Set the "Dart: Dev Tools Browser" setting to "chrome"
  4. debug a Dart program
  5. At a breakpoint, open devtools in browser
  6. Observe that it opens in non-Chrome instead of Chrome

Expected behavior
Setting works, opens in chrome if specified as such.

Screenshots

Image

Please complete the following information:

Workspace Environment
Dart Code extension: 3.106.0

App: Visual Studio Code
App Host: desktop
Remote: wsl
Host Kind: wsl
Version: linux 1.97.2

Workspace type: Dart (LSP)
Workspace name: rohd-hcl [WSL: Ubuntu]

Dart (3.7.0): /usr/lib/dart
Flutter (undefined): undefined (No device)
Output from 'dart info'

/usr/lib/dart/bin/dart info

If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.

General info

Project info

  • sdk constraint: '>=3.0.0 <4.0.0'
  • dependencies: collection, meta, rohd, rohd_vf
  • dev_dependencies: logging, test

Process info

Memory CPU Elapsed time Command line
84 MB 0.3% 06:16 dart devtools --machine --allow-embedding --dtd-uri ws:/qYCG49aSQsE=
382 MB 0.0% 03:49:38 dart language-server --protocol=lsp --client-id=VS-Code-Remote --client-version=3.104.0
431 MB 0.3% 02:14:39 dart language-server --protocol=lsp --client-id=VS-Code-Remote --client-version=3.106.0
362 MB 0.2% 01:37:33 dart language-server --protocol=lsp --client-id=VS-Code-Remote --client-version=3.106.0
332 MB 3.6% 07:00 dart language-server --protocol=lsp --client-id=VS-Code-Remote --client-version=3.106.0
78 MB 0.0% 03:49:38 dart tooling-daemon --machine
79 MB 0.0% 01:37:33 dart tooling-daemon --machine
108 MB 0.5% 07:00 dart tooling-daemon --machine

Activity

  1. DanTup commented on Mar 4, 2025

    @DanTup
    Member

    This is actually working as intended - however I see the description on the setting does not mention this.

    There are generally two modes in which the VS Code extension can run:

    • a "local" extension host
    • a "remote" extension

    When running "locally" (eg. not WSL), the extension host is the same machine where the VS Code UI is running. We can spawn processes and know that the user will see them. In this code, we support launching Chrome (by delegating to the DevTools server, which finds the process and spawns it).

    When running "remotely", the extension host is not running in the same place as the VS Code UI. It might be a remote server/container (for example in the case of Codespaces), but it might also just be some kind of VM like WSL or Docker. In these cases, we cannot be sure that a spawned process would be visible to the user (for example spawning a Chrome process on a backend IDX container would not show up inside the users browser if they're using IDX).

    So, when running "remotely", we never delegate to the DevTools server to spawn Chrome, and instead we always ask the host/IDE to spawn a browser instead (which will use the system default).

    WSL is a little odd in that I think you can spawn Windows processes from within it. However, this is a detail that I don't believe is expressed by the VS Code API (nor do I think the DevTools server would successfully locate a Windows install of Chrome from inside a WSL container), so I think for now we're restricted to this behaviour.

    I'll update the text on the setting to make this clear. I'm also curious why you'd trying to use Chrome specifically here - the reason we originally supported this was just because DevTools/Flutter web didn't work great in other browsers. Since Edge is based on Chromium, I would've expected this to be a non-issue today, and the need to use Chrome specifically is reduced.

  2. added a commit that references this issue on Mar 4, 2025
  3. mkorbel1 commented on Mar 4, 2025

    @mkorbel1
    Author

    Thanks, your updated description I think will help clarify here! This makes sense to me.

    I'm also curious why you'd trying to use Chrome specifically here

    I never looked at this option at all until I was trying to reproduce this issue: flutter/devtools#8982. I've had no problem just using Edge, generally.

  4. DanTup commented on Mar 5, 2025

    @DanTup
    Member

    Thanks, then I'll close this as updating the description being the fix. If you do notice any issues in Edge, then probably it's worth filing them specifically (probably in the DevTools repo, although it's also possible they'd be Flutter or Dart SDK issues).

  5. changed the title [-]"Dart: Dev Tools Browser" setting is not respected in WSL[/-] [+]"Dart: Dev Tools Browser" should be clearly documented as only working for local workspaces[/+] on Mar 5, 2025
  6. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    in docs / websiteRelates to documentation, including the Dart Code website
    and removed on Mar 5, 2025
  7. added this to the v3.108.0 milestone on Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in docs / websiteRelates to documentation, including the Dart Code websiteis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions