You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Having folders from both Dart SDK repo and non-Dart SDK repo in the workspace fails to disable functionality like "dart test" for the SDK repo projects #4011
Is your feature request related to a problem? Please describe.
There exist repositories of dart code that contain pubspec.yaml files, but where it is almost never the right choice to actually run dart pub get. An example of this is the Dart SDK repository, directories under pkg: https://github.com/dart-lang/sdk/tree/main/pkg. Some of these directories contain pubspec.yaml files, but under normal circumstances the workflow for editing them depends on externally constructed .dart_tool directories checked in at the top level which would be overridden by pub get. Some contain pubspec.yaml files that do not reference real packages, as well.
In addition, it can be desirable to manually edit and control .dart_tool directories while developing. Without a way to shut off modifying them via dart pub get, those workflows are disallowed.
Describe the solution you'd like
A configuration option that allows the user to stop dart pub get runs from happening when using the automatic Run | Debug options for tests and main() functions. As well, if pub get fails, the user could be prompted to ignore this. This could be implemented with a simple on/off switch, or a configuration option to change what is run when fetching packages so Dart could be replaced with /bin/true. Other possibilities abound.
Describe alternatives you've considered
-- see above --
Additional context
IntelliJ allows you to semi-permanently ignore pub get failures when they occur, which is compatible with my workflow.
There is an existing setting to disable running pub get when you modify pubspecs:
Additionally, we detect certain types of workspaces and disable this (along with the initial prompt). These include Bazel/Fuchsia workspaces (those with WORKSPACE or .jiri_root files), and also the Dart SDK repo itself.
Is it one of these workspaces you're seeing this in (and if so, is it fetching when you save a pubspec, or just prompting you to run it at project load?). It would be nice if there was a define way for these types of projects to mark themselves (so the user doesn't need to change settings, or we have to guess), like a flag in pubspec.yaml (or some key in .dart_tool/package_config.json?) though I don't know how feasible that is.
This is the Dart SDK repo, subdirectory pkg/analysis_server. Attempting to click on "Run" or "Debug" for any test within results in this problem. The indicated option of Run Pub Get On Pubspec Changes does not help with this.
While auto-detection would be nice, the ability to control manually whether my workspace is modified is the most important part of this bug.
This turns out to be caused by having both SDK-repo and non-SDK-repo folders in the workspace. Flags that decide whether you're in the SDK are currently workspace-wide, and we use the first matching folder (any with a .git folder in the case of the SDK check).
As a short-term workaround, removing the non-SDK folders from the workspace solves the issue. We should handle this better though (which may mean some flags that are currently workspace-wide, need to be tied to WorkspaceFolders).
changed the title [-]Allow disabling of automatic `dart pub get` runs within Dart subdirectories[/-][+]Having folders from both Dart SDK repo and non-Dart SDK repo in the workspace fails to disable functionality like "dart test" for the SDK repo projects[/+]on Jun 9, 2022
Tracking all of these settings individually per-WorkspaceFolder is quite tricky, because some of the settings affect workspace-wide things (like the Flutter daemon, or whether to use LSP). So for now I'm going to fix this in a simpler way. Rather than bailing out of the SDK search when we first find a .git folder, we'll do the checks for the README.dart-sdk file as part of the search (which means if we see a non-SDK git folder, we'll still enumerate the others).
The impact of this is that the things disabled for the SDK (pub functionality, CodeLens per-test, etc.) will also be disabled for other WorkspaceFolders in the same window. I don't believe it will cause any issues this way, it will just be slightly more restrictive than it could be.
We can revisit this is this setup becomes more common (or if it seems like it has introduced issues, or turns out to be more annoying than I'm anticipating).
Activity
DanTup commentedon Jun 9, 2022
There is an existing setting to disable running
pub getwhen you modifypubspecs:Additionally, we detect certain types of workspaces and disable this (along with the initial prompt). These include Bazel/Fuchsia workspaces (those with
WORKSPACEor.jiri_rootfiles), and also the Dart SDK repo itself.Is it one of these workspaces you're seeing this in (and if so, is it fetching when you save a pubspec, or just prompting you to run it at project load?). It would be nice if there was a define way for these types of projects to mark themselves (so the user doesn't need to change settings, or we have to guess), like a flag in
pubspec.yaml(or some key in.dart_tool/package_config.json?) though I don't know how feasible that is.jcollins-g commentedon Jun 9, 2022
This is the Dart SDK repo, subdirectory
pkg/analysis_server. Attempting to click on "Run" or "Debug" for any test within results in this problem. The indicated option ofRun Pub Get On Pubspec Changesdoes not help with this.While auto-detection would be nice, the ability to control manually whether my workspace is modified is the most important part of this bug.
DanTup commentedon Jun 9, 2022
This turns out to be caused by having both SDK-repo and non-SDK-repo folders in the workspace. Flags that decide whether you're in the SDK are currently workspace-wide, and we use the first matching folder (any with a
.gitfolder in the case of the SDK check).As a short-term workaround, removing the non-SDK folders from the workspace solves the issue. We should handle this better though (which may mean some flags that are currently workspace-wide, need to be tied to
WorkspaceFolders).[-]Allow disabling of automatic `dart pub get` runs within Dart subdirectories[/-][+]Having folders from both Dart SDK repo and non-Dart SDK repo in the workspace fails to disable functionality like "dart test" for the SDK repo projects[/+]DanTup commentedon Jun 13, 2022
Tracking all of these settings individually per-WorkspaceFolder is quite tricky, because some of the settings affect workspace-wide things (like the Flutter daemon, or whether to use LSP). So for now I'm going to fix this in a simpler way. Rather than bailing out of the SDK search when we first find a
.gitfolder, we'll do the checks for theREADME.dart-sdkfile as part of the search (which means if we see a non-SDK git folder, we'll still enumerate the others).The impact of this is that the things disabled for the SDK (
pubfunctionality, CodeLens per-test, etc.) will also be disabled for other WorkspaceFolders in the same window. I don't believe it will cause any issues this way, it will just be slightly more restrictive than it could be.We can revisit this is this setup becomes more common (or if it seems like it has introduced issues, or turns out to be more annoying than I'm anticipating).
Detect Dart SDK repo even when not the first Git project in the works…