Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest false above other results when autocompleting a bool setter #37907

Closed
ghost opened this issue Aug 19, 2019 · 14 comments
Closed

Suggest false above other results when autocompleting a bool setter #37907

ghost opened this issue Aug 19, 2019 · 14 comments
Labels
analyzer-completion Issues with the analysis server's code completion feature area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request

Comments

@ghost
Copy link

ghost commented Aug 19, 2019

@MisterJimson commented on Aug 19, 2019, 4:10 PM UTC:

Steps to Reproduce

Set a bool and trigger autocomplete after typing "f";

bool isLoading = true;
isLoading = f

False should be the first item returned, instead of bool.fromEnvironment
Screen Shot 2019-08-19 at 12 05 42 PM

Version info

[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.6 18G87, locale en-CA)
• Flutter version 1.7.8+hotfix.4 at /Users/jrai/dev/flutter
• Framework revision 20e59316b8 (5 weeks ago), 2019-07-18 20:04:33 -0700
• Engine revision fee001c93f
• Dart version 2.4.0

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/jrai/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /Users/jrai/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.3, Build version 10G8
• CocoaPods version 1.7.2

[✓] iOS tools - develop for iOS devices
• ios-deploy 1.9.4

[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 38.2.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[✓] VS Code (version 1.37.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.3.0

[✓] Connected device (1 available)
• iPad Air 2 • 7250467B-9C77-4B88-B47C-35C154EEE5C2 • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-4 (simulator)

• No issues found!

This issue was moved by pq from flutter/flutter-intellij#3799.

@pq pq added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. analyzer-completion Issues with the analysis server's code completion feature labels Aug 19, 2019
@pq
Copy link
Member

pq commented Aug 19, 2019

/cc @danrubel @scheglov

@bwilkerson
Copy link
Member

@lambdabaa

@pq
Copy link
Member

pq commented Feb 14, 2020

I'm no longer seeing this?

image

/cc @jwren

@bwilkerson
Copy link
Member

Do we know that what you're trying there triggered the same behavior that the OP saw?

I tried a couple of variations that are different from what you're trying and see the same behavior, so it's likely that it's fixed. But without reproduction steps it's hard to know for sure.

@pq
Copy link
Member

pq commented Feb 14, 2020

You make a good point. I don't know. I tried a few variations myself and couldn't reproduce (though I'm confident I used to be able to) 🤔

@bwilkerson
Copy link
Member

Then I'm going to close this and ask that the OP re-open it (or ask us to), with a reproduction case, if it doesn't work after the next release.

@pq
Copy link
Member

pq commented Feb 14, 2020

(FWIW: a test of one variation is in https://dart-review.googlesource.com/c/sdk/+/135961; if the issue recurs we should add more test cases there.)

@MisterJimson
Copy link

I'll try to repro and report back

@MisterJimson
Copy link

Ha, so false was fine. It was at the stop of the list after typing f.

So I tried true with tr.

Screen Shot 2020-02-14 at 2 34 31 PM

My project shouldn't even allow dart:html, it's a flutter project.

@bwilkerson bwilkerson reopened this Feb 14, 2020
@scheglov
Copy link
Contributor

The reason why Element.tr is prioritized is that for IntelliJ it is an "exact match", which gives it higher weight than "prefix match".

@MisterJimson
Copy link

Does it not take into account types? Element.tr() doesn't return something that would be assignable to a boolean.

@scheglov
Copy link
Contributor

AFAIK it does, but this weigher is lower than the exact match one.
For example, in Java:

Type a prefix so that both aa and aaa match, and the matching type is higher.
image

Type aa, and now aa is the exact match, so it is higher.
image

The logic, I think, is that even though the exact match might be not the type you are looking for, you might call something one it, to get the necessary type, e.g. java.lang.String.length().

@MisterJimson
Copy link

Right, kk.

@srawlins srawlins added the P3 A lower priority bug or feature request label Nov 10, 2020
@bwilkerson bwilkerson added this to To do in Code completion update 2021 via automation Jan 23, 2021
@bwilkerson
Copy link
Member

I believe that this was fixed by https://dart-review.googlesource.com/c/sdk/+/184861 (modulo any re-ordering done by IntelliJ).

Code completion update 2021 automation moved this from To do to Done Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-completion Issues with the analysis server's code completion feature area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. P3 A lower priority bug or feature request
Development

No branches or pull requests

5 participants