question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code completion not working after 'yield' keyword

See original GitHub issue

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)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
scheglovcommented, Oct 25, 2019

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 ^;
}
2reactions
FeleConvocommented, Oct 13, 2019

+1 to this, especially uncomfortable for the BLoC pattern

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pycharm Code Completion does not work in methods or ...
This is so weird... Code completion only works outside a method... Anyone know how to fix this? enter image description here.
Read more >
C# return keyword after a yield doesn't get highlighted
Visual studio does not highlight the "return" keyword in the autocomplete list following a yield inside an IEnumerator block.
Read more >
Python | yield Keyword - GeeksforGeeks
In layman terms, the yield keyword will turn any expression that is given with it into a generator object and return it to...
Read more >
Generators - The Modern JavaScript Tutorial
Generators can return (“yield”) multiple values, one after another, ... not the name, so it should stick with the function keyword.
Read more >
Behind the scenes of the C# yield keyword - Lars Corneliussen
After reading the great article about the code-saving yield keyword “Give way to the yield keyword” by Shay Friedman I thought it could...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found