Flutter-intellij: Android Studio Editor IntelliJ Intention / Context Actions (Alt+Enter) not functioning

Created on 4 Jul 2020  Â·  6Comments  Â·  Source: flutter/flutter-intellij

Suspected error in Flutter Plugin version 47.1.2 (My Windows 10 system).
Flutter Plugin version 46.0.2 works correctly (My Linux system).

If the cursor caret is placed at or inside a widget name, there is no yellow intention bulb, and Alt+Enter does not bring up the list of suggestions as stated here: https://www.jetbrains.com/help/idea/intention-actions.html

Right-clicking the widget name allows you to select Show Context Actions from the context menu, but then a message is shown "No context actions available at this location".
Intent Editor NO Popup Windows Flutter Plugin v47 1 2

Right clicking on the widget in the Flutter Outline does bring up a context menu allowing to wrap with certain widgets (though there is no option to "Wrap with widget").
Intent Outline Popup Windows Flutter Plugin v47 1 2

The red bulb does appear if there are errors on the line.
Red Bulb

The yellow bulb does not appear when the cursor caret is within a widget name.
The yellow bulb does appear when the cursor caret is placed after the last ")," in a descending tree.
It also appears if the cursor is inside a text comment, and sometimes after the comma at the end of a parameter line, for example in the default project:

floatingActionButton: FloatingActionButton(
  onPressed: _incrementCounter,
  tooltip: 'Increment',
  child: Icon(Icons.add),

The yellow bulb appears when the cursor is at the end of the onPressed: and tooltip: lines only. The only context action is to Flip.
Yellow Bulb

File menu -> Settings:
Intention Bulb
Editor Intentions

=========================================================================
System: Windows 10
The context actions do not work.

flutter doctor -v
[√] Flutter (Channel stable, v1.17.5, on Microsoft Windows [Version 10.0.18362.295], locale en-GB)
• Flutter version 1.17.5 at E:\Flutter
• Framework revision 8af6b2f038 (3 days ago), 2020-06-30 12:53:55 -0700
• Engine revision ee76268252
• Dart version 2.8.4

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
• Android SDK at D:\Users\JohnAppData\LocalAndroid\sdk
• Platform android-30, build-tools 30.0.0
• Java binary at: C:\Program FilesAndroidAndroid Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.

[√] Android Studio (version 4.0)
• Android Studio at C:\Program FilesAndroidAndroid Studio
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.46.1)
• VS Code at D:\Users\JohnAppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.12.0

[!] Connected device
! No devices available

! Doctor found issues in 1 category.

=========================================================================
System: Linux Mint
The context actions work correctly.

flutter doctor -v
[✓] Flutter (Channel stable, v1.17.3, on Linux, locale en_GB.UTF-8)
• Flutter version 1.17.3 at /home/john/Programs/flutter
• Framework revision b041144f83 (4 weeks ago), 2020-06-04 09:26:11 -0700
• Engine revision ee76268252
• Dart version 2.8.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
• Android SDK at /home/john/Android/Sdk
• Platform android-30, build-tools 30.0.0
• Java binary at: /home/john/Programs/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.

[✓] Android Studio (version 4.0)
• Android Studio at /home/john/Programs/android-studio
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6222593)

[!] Connected device
! No devices available

! Doctor found issues in 1 category.

Context Actions work correctly in Linux with Flutter Plugin version 46.0.2

Intent Editor Popup Linux Flutter Plugin v46 0 2

question

Most helpful comment

Ek Açıklama 2020-07-04 143025

I think problem solved by me. You wants this like picture using shortcut with Alt+Enter shown the Show Context Actions.
Firstly you must install a plugin for Show Context Actions. You can follow that steps:
Open -> SDK manager -> left menu Plugins -> when on Marketplace search " Flutter Snippets" after that install plugin restart IDE.
Your problem solved.
Secondly your option; If you wants change shortcuts you can follow steps:
Android Studio File --> Settings --> Keymap --> Search this keyword "Show Context Actions" Right click Add Keyword Shortcut in area you can make the choice you want shortcuts. For example I want to chosee Ctrl+Space:

ctrl+space

I hope help for you

All 6 comments

Ek Açıklama 2020-07-04 143025

I think problem solved by me. You wants this like picture using shortcut with Alt+Enter shown the Show Context Actions.
Firstly you must install a plugin for Show Context Actions. You can follow that steps:
Open -> SDK manager -> left menu Plugins -> when on Marketplace search " Flutter Snippets" after that install plugin restart IDE.
Your problem solved.
Secondly your option; If you wants change shortcuts you can follow steps:
Android Studio File --> Settings --> Keymap --> Search this keyword "Show Context Actions" Right click Add Keyword Shortcut in area you can make the choice you want shortcuts. For example I want to chosee Ctrl+Space:

ctrl+space

I hope help for you

Well, would you believe it! After a few hours sleep, I turn my Windows 10 laptop on, open my project, and suddenly it's all working properly again. I have done no alterations, no updates, nothing has changed, and yet... it works!

@SadSack963 thanks for the detailed report. You provided enough evidence that we know the analysis server was working. I wonder if there was a timing issue, which was resolved by restarting the IDE? At this point I think we do not know if the analysis server was working as it should. If you ever see a repeat of this problem could you check the size of the analysis server process? It if is simply huge then perhaps there is a memory leak.

I'm leaving this open for now because it sounds like there may be a problem.

@stevemessick Thanks for the comment. This issue has not yet reoccurred, so it was hopefully just a one-off event.

I just went through the same thing, but I noticed that my Flutter Inspector was freezed in my splashscreen class, so I refreshed it and the context actions returned. If it happens again, give it a try.

If you are using MacOS try closing Android Studio and making sure that it is not running in the background, then reopen it again, worked for me.

Was this page helpful?
0 / 5 - 0 ratings