Flutter-intellij: Code completion not working after 'yield' keyword

Created on 11 Oct 2019  ·  8Comments  ·  Source: flutter/flutter-intellij

I'm not sure if this is a plugin error or an Android Studio error.

The error is as follows:
Typing after the yield keyword does not show any code completion suggestions.

Steps to Reproduce

Create a function like:

Stream<MyState> mapEventToState(MyEvent event) async* {
  //do some stuff
  yield /*Cursor is here*/
}

After the yield keyword the code completion does not show.
Manually opening the code completion shows 'No suggestions'.

Version info

Android Studio 3.6 Beta 1
Build #AI-192.6603.28.36.5916306, built on October 3, 2019
Runtime version: 1.8.0_212-release-1586-b04 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 3038M
Cores: 4
Registry: ide.editor.tabs.open.at.the.end=true, bigger.font.in.project.view=true, ide.new.welcome.screen.force=true, ide.tree.ui.experimental=false, ide.balloon.shadow.size=0
Non-Bundled Plugins: String Manipulation, com.github.shiraji.colormanager, com.potterhsu.jsonviewer, krasa.CpuUsageIndicator, mobi.hsz.idea.gitignore, net.vektah.codeglance, org.intellij.RegexpTester, org.jetbrains.kotlin, com.chrisrm.idea.MaterialThemeUI, me.scana.okgradle, net.nerrd.intellij.plugin.dpicalculator, Dart, izhangzhihao.rainbow.brackets, com.vladsch.idea.multimarkdown
[√] Flutter (Channel beta, v1.9.1+hotfix.4, on Microsoft Windows [Version 10.0.18362.418], locale en-US)
    • Flutter version 1.9.1+hotfix.4 at C:\flutter
    • Framework revision cc949a8e8b (2 weeks ago), 2019-09-27 15:04:59 -0700
    • Engine revision b863200c37
    • Dart version 2.5.0


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at F:\SDK
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = F:\SDK
    • Java binary at: C:\Users\User\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-1\192.5916306\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.

[√] Android Studio (version 3.6)
    • Android Studio at C:\Users\User\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-1\192.5916306
    • Flutter plugin version 40.1.3
    • Dart plugin version 192.6603.23
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

Most helpful comment

Just anything could go after yield. Even if it is not of the same type as the Stream argument, it might be a start of a sequence that will return the required type.

Here for aaa and bbb are fine, aaa is int, and bbb.hashCode is int.

Unfortunately we don't suggest anything, I guess we miss this type of node completely.

Stream<int> mapEventToState() async* {
  var aaa = 0;
  var bbb = '';
  yield ^;
}

All 8 comments

Thanks for the report. This looks like a blind spot in the analysis server.

/move to dart-lang/sdk

⚠️ The GitHub App must be installed for the target repository.

/move to dart-lang/sdk

⚠️ The GitHub App must be installed for the target repository.

@mit-mit: any thoughts on why the move bot is unhappy? (I thought the SDK was configured to receive moves?)

+1 to this, especially uncomfortable for the BLoC pattern

@scheglov What sort of completion suggestions would you expect to see after yield?

We used to be able to move issues to dart-lang/sdk but it appears the move bot is no longer installed. @mit-mit is that intentional?

Just anything could go after yield. Even if it is not of the same type as the Stream argument, it might be a start of a sequence that will return the required type.

Here for aaa and bbb are fine, aaa is int, and bbb.hashCode is int.

Unfortunately we don't suggest anything, I guess we miss this type of node completely.

Stream<int> mapEventToState() async* {
  var aaa = 0;
  var bbb = '';
  yield ^;
}
Was this page helpful?
0 / 5 - 0 ratings