Skip to content

Disable addSdkToTerminalPath not working #4545

Closed

Description

@quyenvsp

Describe the bug
When disable addSdkToTerminalPath it still add path to Integrated terminal.

To Reproduce
Steps to reproduce the behavior:

  1. Setting dart.addSdkToTerminalPath to false
  2. Close VSCode then open again (even restarted computer)
  3. Run in Integrated terminal which flutter
  4. See result, it still add default flutter location to Path

Expected behavior
Don't touch anything in PATH when addSdkToTerminalPath disabled.

Screenshots
Problem - it still select one version in many version at Sdk Paths then set to ahead $PATH
problem

Normal - when not open Flutter project, it is correct $PATH which set in system variables
normal

Please complete the following information:

  • Operating System and version: Windows 11
  • VS Code version: 1.78.2 (user setup)
  • Dart extension version: v3.64.0 (tried pre-release, same issue)
  • Dart/Flutter SDK version: Dart 3.0.0 / Flutter 3.10.0

Activity

  1. DanTup commented on May 16, 2023

    @DanTup
    Member

    I don't seem to be able to reproduce this. The code in the extension is definitely wrapped with a check for this setting:

    if (config.addSdkToTerminalPath) {
    const baseSdk = workspaceContext.hasAnyFlutterProjects
    ? sdks.flutter
    : sdks.dart;
    const envPathPrefix = [baseSdk, "bin", path.delimiter].join(path.sep);
    context.environmentVariableCollection.prepend("PATH", envPathPrefix);
    }

    I notice that your paths are in a different format (you have a Windows path in your settings, but not in the which output) - are you using WSL or something?

    Could you also try clicking the trashcan icon against the affected terminal and re-create it to see if that makes a difference? I think VS Code tries to reuse terminal sessions but I don't know what it persists for them.

  2. added
    awaiting infoRequires more information from the customer to progress
    on May 16, 2023
  3. quyenvsp commented on May 16, 2023

    @quyenvsp
    Author

    Hi,

    Thank so much for your quick response. I found a solution but these are more info maybe helpful other.

    I current using windows 11 + fvm (with alias flutter = fvm flutter) + git bash for windows.

    I notice that your paths are in a different format

    It is git bash, but I used Three dot > Clear terminal for clear data so it look like that.

    Could you also try clicking the trashcan icon

    Yeah I tried on two computer but same error.

    Solution is disable addSdkToTerminalPath first then disabled Flutter / Dart plugin then enable again. It working now but I will keep tracking it more.

  4. DanTup commented on May 16, 2023

    @DanTup
    Member

    Solution is disable addSdkToTerminalPath first then disabled Flutter / Dart plugin then enable again.

    hmm, that's odd. That sounds like it could be a VS Code issue - I don't think it's intended to require that.

    Would you mind filing an issue describing this at https://github.com/microsoft/vscode and CCing me so we can see if it's something they can fix (or, if it's intended, it can be clarified how we should handle this)?

    Thanks!

  5. DanTup commented on May 16, 2023

    @DanTup
    Member

    Oh, apparently this is intended - there's a "persistent" flag on it. I will fix this (and figure out why I'm not seeing the same behaviour).

  6. reopened this on May 16, 2023
  7. added this to the v3.66.0 milestone on May 16, 2023
  8. removed
    awaiting infoRequires more information from the customer to progress
    on May 16, 2023
  9. DanTup commented on May 16, 2023

    @DanTup
    Member

    Turns out I can repro this now. I'm not sure what I did wrong earlier - although I note that after restarting VS Code I do need to click the trashcan to delete the terminal before any PATH change takes effect (so there's definitely some additional caching going on beyond this).

  10. DanTup commented on May 16, 2023

    @DanTup
    Member

    Fixed by d011b9a.

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions