Visual Studio Code not using project environment #42
Replies: 18 comments
-
|
what is the output of |
Beta Was this translation helpful? Give feedback.
-
|
And how do you know VSCode is using stable instead of v3_7_6? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
@czaefferer do you mind sharing the launch configuration, and the build output that shows the flutter SDK info? Maybe I can try to recreate on my system to see. Also. what platform (Windows 11, etc) are you using to develop flutter, and also VS Code versions? |
Beta Was this translation helpful? Give feedback.
-
|
@czaefferer one other thing you might also want to try, if you haven't already, is to enable the "Add Sdk To Terminal Path" option in VSCode settings, then run BTW, in theory every time you change the env, VS Code should prompt to run |
Beta Was this translation helpful? Give feedback.
-
|
@czaefferer Make sure the |
Beta Was this translation helpful? Give feedback.
-
|
@tksoh I've got "dart.addSdkToTerminalPath" activated, when I switch the SDK manually this change is reflected in the CLI, so that works from what I can tell. And also VSCode does indeed prompt me to update dependencies whenever I switch the SDK. It's just that VSCode doesn't switch the SDK by itself. To make it easier to reproduce, I've created a new workspace and two new projects for testing. I'm using Ubuntu 22.04.3 LTS and VSCode 1.82.2. These are the steps I've done:
The final folder-structure (after some cleanup) looks like this: |
Beta Was this translation helpful? Give feedback.
-
By "switch the SDK manually", do you mean by running |
Beta Was this translation helpful? Give feedback.
-
|
@tksoh No, I've got "Flutter SDK" in the status bar, where I can see the currently active SDK when hovering over it, and select an SDK from "dart.flutterSdkPaths" when clicking: If nothing is configured in "dart.flutterSdkPaths", it will show the default Flutter SDK (from /home/cza/.puro/envs/default/flutter/bin/flutter) and not allow me to change it, even with the .vscode/settings.json files in the projects. |
Beta Was this translation helpful? Give feedback.
-
And this happened when you switch via 'puro use' to switch, as well as manually changing the path via vs code? BTW, thanks for capturing such details in your earlier post. It helps a lot. |
Beta Was this translation helpful? Give feedback.
-
No, only when I switch manually. I can see the explorer in VSCode update when the settings-files are created, but no prompt to update dependencies. |
Beta Was this translation helpful? Give feedback.
-
Hmm... seems to me that your VSCode might be ignoring your workspace settings (.vscode/settings.json) somehow. I did a quick google on the topic, but haven't found much discussion on this issue. Perhaps you can experiment with the workspace settings for your projects, to confirm if VSCode would pick them up as intended. If indeed they don't, then this might be something to ask on the VSCode forums. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I don't quite understanding what you meant by "whenever I open a dart file from the other project". I usually have one VSCode window for each flutter/dart project, except on rare occasions I would open some file outside those projects, such as ~/.bashrc, etc. BTW, how do you get the Flutter SDK version to show up on the status bar. I can't quite find the way to get the VSCode on my Windows 11 PC to display that. Not sure if that might tell us there's some difference between VSCode on Windows vs Linux. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Indeed I haven't 😅 So I gave it a tried, and here's what I found... If I open my 'test' project as I normally do without workspace, VSCode picks up the flutter version 3.7.12 set by Here's the output of Perhaps VS Code ignores @pingbird any thought? |
Beta Was this translation helpful? Give feedback.
-
|
More discovery... According to VSCode doc, the settings for a multi-root workspace are actually stored inside the By editing the content of I guess it now comes down to how puro would support multi-root workspace. Until then, you can manually update the path to point to puro env of your choice. It's not ideal, but it's still better than add the paths to user settings manually. |
Beta Was this translation helpful? Give feedback.
-
|
BTW, the doc also mentions that "Settings configured per folder will override settings defined in the .code-workspace". Although in my experiment, VSCode does NOT pick up the flutter path in |
Beta Was this translation helpful? Give feedback.









Uh oh!
There was an error while loading. Please reload this page.
-
I have configured "stable" as the global environment, and created an environment called "v3_7_6" for Flutter 3.7.6.
For an app still using Flutter 3.7, I configured puro to use this environment. If I run "puro flutter run" from the terminal in the project directory, it runs the app with the 3.7 environment.
However, if I try to start the app from Visual Studio Code, it will use the stable environment, instead of the configured one.
The settings.json file created by puro looks like this:
What do I need to do?
Beta Was this translation helpful? Give feedback.
All reactions