Skip to content

Prevent DTD from cluttering the VS Code Ports section with previously forwarded ports #5403

Closed

Description

@tschaffter

Is your feature request related to a problem? Please describe.
The DTD process listens on a random port when it starts. VS Code automatically forwards this port and lists it in the Ports section of the IDE. Each time VS Code is closed and reopened, a new DTD process starts, and a new port is forwarded. Over time, this leads to an accumulation of previously forwarded ports, making it difficult to identify the ports of interest.

Image

Describe the solution you'd like
It is possible to specify the port that DTD listens to. The solution would be to allow the Dart VS Code extension to configure this port in settings.json. This way, DTD will always listen on the same port, preventing clutter in the Ports section.

https://github.com/dart-lang/sdk/blob/d209ea93337ce858359abc50ebed428a0eab0a41/pkg/dtd_impl/lib/dart_tooling_daemon.dart#L34-L37

Describe alternatives you've considered
I searched the existing options exposed by this VS Code extension for "DTD," "daemon," and "port" but couldn't find an option that allows passing additional parameters to the command that starts DTD.

const daemonArgs = [
"tooling-daemon",
"--machine",
];

Additional context
None

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Feb 1, 2025
  2. added this to the v3.106.0 milestone on Feb 5, 2025
  3. added
    in dtdRelates to integration with the Dart Tooling Daemon
    on Feb 5, 2025
  4. DanTup commented on Feb 5, 2025

    @DanTup
    Member

    Thanks for the info, this is now supported:

    "dart.toolingDaemonAdditionalArgs": [
    	"--port=1234"
    ]

    You'll need to restart/reload when you change this (you'll ofc also need a future release of the extension that includes the change).

    It feels like a bug that VS Code is building up the ports even after the processes terminate (unless they're not terminating, in which case it's a bug of ours - please let me know if you're able to confirm if that's the case).

    Thanks!

  5. tschaffter commented on Feb 10, 2025

    @tschaffter
    Author

    Thanks for the update, @DanTup !

    It feels like a bug that VS Code is building up the ports even after the processes terminate

    AFAIK VS Code does not remove automatically ports once they have been forwarded. Note that VS Code users can preemptively forward ports even if no processes are currently listening to them.

  6. DanTup commented on Feb 10, 2025

    @DanTup
    Member

    Note that VS Code users can preemptively forward ports even if no processes are currently listening to them.

    Ah, I see - I thought it was only valid to be forwarded when there was a process. In that case, the behaviour seems less weird. This fix should help then :-)

    (btw, this change is in the current pre-release version of the extension if you want to try it out before it ships in the stable version)

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 dtdRelates to integration with the Dart Tooling Daemonis 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