flutter-intellij icon indicating copy to clipboard operation
flutter-intellij copied to clipboard

JetBrains IDE (IntelliJ) does not understand workspaces (always suggests to run pub get even when it's been run)

Open jwren opened this issue 1 year ago โ€ข 21 comments

Tracking issue for https://github.com/dart-lang/sdk/issues/56380 in the flutter/flutter-intellij bug repo.

jwren avatar Aug 22 '24 20:08 jwren

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)
...

jwren avatar Aug 22 '24 20:08 jwren

https://youtrack.jetbrains.com/issue/IDEA-354613/Multiple-tool-windows-throw-IllegalStateException-access-contentManager-when-its-not-yet-available

AlexanderBartash avatar Sep 19 '24 07:09 AlexanderBartash

To add onto this: Tests also always run flutter pub get before executing the tests as well, slowing down test execution.

To reproduce:

  1. Create unit / widget test
  2. Run test
  3. See pub get executed
  4. See results (pass / fail)
  5. Run again
  6. Pub get run again

brian-superlist avatar Sep 19 '24 15:09 brian-superlist

@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.

sigurdm avatar Oct 22 '24 08:10 sigurdm

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?

image

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.

sigurdm avatar Oct 24 '24 13:10 sigurdm

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...

sigurdm avatar Oct 25 '24 08:10 sigurdm

Start of work that I believe will be sufficient: https://github.com/JetBrains/intellij-plugins/pull/933

jwren avatar Nov 23 '24 00:11 jwren

Closing out since the PR has been pushed over to JetBrains.

jwren avatar Nov 26 '24 23:11 jwren

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. IntelliJ IDEA 2024-12-15 10 31 37

BenevidesLecontes avatar Dec 15 '24 13:12 BenevidesLecontes

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. IntelliJ IDEA 2024-12-15 10 31 37

Same issue for me

sbergmair avatar Jan 24 '25 06:01 sbergmair

@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.

jwren avatar Jan 24 '25 19:01 jwren

IntelliJ IDEA 2024.3.2.2 (Community Edition) Dart 243.23654.44 Flutter 83.0.4

Still reproducing

Autocrab avatar Feb 11 '25 08:02 Autocrab

I am also experiencing this issue.

IntelliJ IDEA 2024.3.3 (Ultimate Edition) Dart 243.23654.44 Flutter 83.0.4

NicolaVerbeeck avatar Feb 18 '25 07:02 NicolaVerbeeck

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)

sbergmair avatar Mar 11 '25 07:03 sbergmair

Come on, guys, it's been 4 months ๐Ÿ˜„

karroze avatar Mar 31 '25 06:03 karroze

@jwren - can you validate if this still reproduces?

sigurdm avatar Mar 31 '25 12:03 sigurdm

@sigurdm - It still occurs for me.

Flutter plugin: 83.0.4 IntelliJ IDEA 2024.3.5 (Ultimate Edition) - Windows

Mueco42 avatar Mar 31 '25 12:03 Mueco42

@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

Image

alextekartik avatar Apr 07 '25 08:04 alextekartik

Perhaps more info: I have also been trying Cursor for the past few months and the Dart Code plugin also:

  1. Always suggests to run pub get
  2. Always runs pub get on 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.

brian-superlist avatar Apr 07 '25 09:04 brian-superlist

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

btrautmann avatar Apr 15 '25 15:04 btrautmann

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

karroze avatar May 27 '25 07:05 karroze

Feature request: Adaptor for workspaces

LongXiangGuo avatar Jul 10 '25 02:07 LongXiangGuo

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.

jwren avatar Aug 07 '25 21:08 jwren

The fix indeed worked. After almost a year, I can finally stop abusing my poor MacBook with over a 100 packages big monorepo projects ๐Ÿ˜‚๐Ÿ‘

karroze avatar Aug 18 '25 07:08 karroze

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)

karroze avatar Aug 18 '25 08:08 karroze

Also still occurring for me, also on the current 87.1

ldt-fweichert avatar Aug 20 '25 09:08 ldt-fweichert

Yeah, we're seeing the same number of contexts we were seeing prior to this being closed/fixed.

btrautmann avatar Aug 20 '25 13:08 btrautmann

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

jwren avatar Aug 20 '25 16:08 jwren

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.

btrautmann avatar Aug 20 '25 16:08 btrautmann