flutter-intellij
flutter-intellij copied to clipboard
JetBrains IDE (IntelliJ) does not understand workspaces (always suggests to run pub get even when it's been run)
Tracking issue for https://github.com/dart-lang/sdk/issues/56380 in the flutter/flutter-intellij bug repo.
Using the latest version of the Flutter IJ plugin, 2024.2, Flutter IJ plugin 242.20629, I get the following when I run dart pub get with the flutter/engine repository I am getting this error:
Because _engine_workspace depends on yaml from path which doesn't exist (could not find package yaml at "third_party/dart/third_party/pkg/yaml"), version
solving failed.
And this error from the Dart IJ plugin:
java.lang.IllegalStateException: access contentManager when it's not yet available
at com.intellij.ui.content.impl.MessageViewImpl.getContentManager(MessageViewImpl.kt:47)
at com.jetbrains.lang.dart.ide.actions.DartPubActionBase.findExistingInfoForCommand(DartPubActionBase.java:308)
at com.jetbrains.lang.dart.ide.actions.DartPubActionBase.showPubOutputConsole(DartPubActionBase.java:260)
at com.jetbrains.lang.dart.ide.actions.DartPubActionBase.doPerformPubAction(DartPubActionBase.java:242)
at com.jetbrains.lang.dart.ide.actions.DartPubActionBase.performPubAction(DartPubActionBase.java:207)
at com.jetbrains.lang.dart.ide.inspections.DartOutdatedDependenciesInspection$RunPubFix.applyFix(DartOutdatedDependenciesInspection.java:139)
...
https://youtrack.jetbrains.com/issue/IDEA-354613/Multiple-tool-windows-throw-IllegalStateException-access-contentManager-when-its-not-yet-available
To add onto this: Tests also always run flutter pub get before executing the tests as well, slowing down test execution.
To reproduce:
- Create unit / widget test
- Run test
- See pub get executed
- See results (pass / fail)
- Run again
- Pub get run again
@helin24 is this on track? We'd love workspaces to work also in intellij with the release of dart 3.6.
Feel free to reach out if you need help with anything.
I tried to reproduce the issue
I used
- IntelliJ IDEA 2022.3.3 (Community Edition)
- Dart plugin 223.8977
- Dart from Flutter 3.24.3 โข channel stable
Even in a non-workspace, I always have the button that suggests to run pub get.
Is there some other suggestion that is depending on the freshness of the resolution?
Also I tried loading the engine with the third_party/dart/third_party/pkg/yaml missing. I got an error from pub get (as expected) but I did not see the java.lang.IllegalStateException: - maybe there is some console I am missing.
Is there some other suggestion that is depending on the freshness of the resolution?
I realized I was only using the dart plugin - not the flutter plugin.
maybe there is some console I am missing.
Ah - these logs come in the terminal when intellij is started from terminal...
Ok - still haven't reproduced exactly - but I'm getting closer...
Start of work that I believe will be sufficient: https://github.com/JetBrains/intellij-plugins/pull/933
Closing out since the PR has been pushed over to JetBrains.
Hi @jwren is this issue already fixed? Because I'm using the latest version of Intellij and de latest dev flutter plugin and i'm seeing this issue.
Hi @jwren is this issue already fixed? Because I'm using the latest version of Intellij and de latest dev flutter plugin and i'm seeing this issue.
Same issue for me
@sbergmair Yes, I thought this was fixed with the latest versions of the Flutter and Dart Plugins. Which version of the Flutter Plugin do you have installed. Do you have a repro you can share.
IntelliJ IDEA 2024.3.2.2 (Community Edition) Dart 243.23654.44 Flutter 83.0.4
Still reproducing
I am also experiencing this issue.
IntelliJ IDEA 2024.3.3 (Ultimate Edition) Dart 243.23654.44 Flutter 83.0.4
Issue is still there
Flutter plugin: 83.0.4
IntelliJ IDEA Community Edition (version 2024.3.2)
Flutter (Channel stable, 3.27.2, on macOS 15.3.1 24D70 darwin-arm64)
Come on, guys, it's been 4 months ๐
@jwren - can you validate if this still reproduces?
@sigurdm - It still occurs for me.
Flutter plugin: 83.0.4 IntelliJ IDEA 2024.3.5 (Ultimate Edition) - Windows
@jwren I created a sample project (one flutter and one dart project in a workspace) here: https://github.com/tekartikdev/publicexp/tree/flutter_intellij_issue_7623
You can simply open the workspace_exp folder in intellij (using #IU-243.26053.27 and latest dart/flutter plugins as of today), it keeps telling pub get has not been run (when opening the main.dart flutter file for example). It slows downs test as mentionned above and even screw suggestion sometimes as it always ask to to a pub get before any other actions.
Same thing happen with Android Studio
Perhaps more info: I have also been trying Cursor for the past few months and the Dart Code plugin also:
- Always suggests to run
pub get - Always runs
pub geton tests.
Not sure if this is helpful info, but it may not be an IDE-specific problem and more of a general Dart / analyzer issue. I have updated our project to the latest analyzer package as well (7.3.0) to make sure it wasn't due to an outdated dependency.
Question: Is it a known issue that when using Intellij, one context is still created/maintained per-package? I'm not sure if that's being captured by this ticket or whether only the pub get issue is being tracked.
To be more specific, we have a workspace where, per the VSCode analyzer diagnostics, we should have 9 analyzer contexts; one for the workspace and 8 more for packages not being declared as part of the workspace.
In Android Studio's analyzer diagnostics, we see 37 total contexts, one for each package (and an additional one for the root of the workspace).
We mostly use VScode but have a few developers who prefer Android Studio and they're experiencing pretty poor analyzer performance. I'm wondering if I should create a new issue or whether this is known and tracked by this one.
For context, the following versions are in use:
- Flutter Plugin 85.1.2
- Dart Plugin 242.24931
- Flutter 3.29.2
- Dart 3.7.2
This is absolutely insane that critical bug can not be fixed in more than half a year. Makes me question really hard why exactly have I purchased a license and why have I been a loyal client for over a decade. This is just sad
Feature request: Adaptor for workspaces
Thank you @alextekartik for the repo. We'll push out the Flutter IJ plugin next week with this fix, https://github.com/flutter/flutter-intellij/pull/8428.
The fix indeed worked. After almost a year, I can finally stop abusing my poor MacBook with over a 100 packages big monorepo projects ๐๐
Nah, I was too fast to jump to that conclusion... it still does not work. Plugin version 87.1
And this statement is beyond devious ๐คจ
Additional work may be needed for non-flutter pubspecs (i.e. the Dart IJ plugin)
Also still occurring for me, also on the current 87.1
Yeah, we're seeing the same number of contexts we were seeing prior to this being closed/fixed.
Thank you for the feedback and apologies for the nuisance notification. Given the cost of these extensions in the platform as well as the risk for false positives for this particular check, we are removing it for the time being, see https://github.com/flutter/flutter-intellij/issues/8481.
To pick up this fix, consider the dev channel of the Flutter IntelliJ plugin: https://github.com/flutter/flutter-intellij/blob/main/docs/Dev-Channel.md
Thank you for the feedback and apologies for the nuisance notification. Given the cost of these extensions in the platform as well as the risk for false positives for this particular check, we are removing it for the time being, see #8481.
To pick up this fix, consider the dev channel of the Flutter IntelliJ plugin: https://github.com/flutter/flutter-intellij/blob/main/docs/Dev-Channel.md
Just to clarify--is the expectation that my comment here is being addressed at all with these changes? I understand that workspaces have impacted the display of when pub get can be run and that's the focus here, but it seems like none of the conversation here has been about the actual fact that workspaces don't even seem to be beneficial at all if you're using Intellij.