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

switch expression snippet does not show after "return" #4843

Closed
simphotonics opened this issue Nov 17, 2023 · 5 comments
Closed

switch expression snippet does not show after "return" #4843

simphotonics opened this issue Nov 17, 2023 · 5 comments
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available
Milestone

Comments

@simphotonics
Copy link

In Dart Code v3.76.1, the auto-completion menu shows the entry switch expression when defining a variable:

final String message = swi

It would be useful, if the entry switch expression is presented whenever an expression is expected.

For example in the following circumstances:

// After the symbol =>
String message() => swi

// After the keyword return
String message(){
  return swi
}
@DanTup DanTup added this to the v3.78.0 milestone Nov 20, 2023
@DanTup DanTup added in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server labels Nov 20, 2023
@DanTup DanTup changed the title Autocompletion: Add trigger for switch expression after "return" and "=>" switch expression snippet does not show after "return" and "=>" Nov 27, 2023
@DanTup
Copy link
Member

DanTup commented Nov 27, 2023

While trying to reproduce this, I noticed some odd behaviour where the items shown in completion can change for the same content. I'll investigate that first, because it might be the cause of some of the issue here:

#4860

@DanTup
Copy link
Member

DanTup commented Nov 27, 2023

Ignore that - my bug was caused by another existing known issue and unrelated to this.

With that resolved, using the latest SDKs I can only reproduce your second issue (in the return statement). The first example seems to work fine:

image

Can you confirm your Dart/Flutter SDK version? (and I'll look into the return one).

@simphotonics
Copy link
Author

simphotonics commented Nov 27, 2023

Just updated my Dart SDK from version 3.1.5 to 3.2.0

$ dart --version
Dart SDK version: 3.2.0 (stable) (Tue Nov 14 18:26:59 2023 +0000) on "linux_x64"

With version 3.2.0 the switch expression entry is indeed presented after =>, but not after return.

@DanTup
Copy link
Member

DanTup commented Nov 27, 2023

Great, thanks for confirming. I have a fix open for the return issue at https://dart-review.googlesource.com/c/sdk/+/338401.

@DanTup DanTup added the relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available label Nov 27, 2023
copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Nov 27, 2023
…ements

Fixes Dart-Code/Dart-Code#4843

Change-Id: I59c41c2ef6439583465a729785fe379c03583cce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338401
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
@DanTup
Copy link
Member

DanTup commented Nov 27, 2023

Fixed by dart-lang/sdk@7d3020f. The change is in the analysis server so will ship in a future Dart/Flutter SDK.

@DanTup DanTup closed this as completed Nov 27, 2023
@DanTup DanTup changed the title switch expression snippet does not show after "return" and "=>" switch expression snippet does not show after "return" Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in editor Relates to code editing or language features in lsp/analysis server Something to be fixed in the Dart analysis server is bug relies on sdk changes Something that requires changes in the Dart/Flutter SDK to ship before it will become available
Projects
None yet
Development

No branches or pull requests

2 participants