Skip to content

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

Closed

Description

@simphotonics

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
}

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Nov 17, 2023
  2. added this to the v3.78.0 milestone on Nov 20, 2023
  3. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    on Nov 20, 2023
  4. changed the title [-]Autocompletion: Add trigger for switch expression after "return" and "=>"[/-] [+]switch expression snippet does not show after "return" and "=>"[/+] on Nov 27, 2023
  5. added and removed
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Nov 27, 2023
  6. DanTup commented on Nov 27, 2023

    @DanTup
    Member

    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

  7. DanTup commented on Nov 27, 2023

    @DanTup
    Member

    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).

  8. simphotonics commented on Nov 27, 2023

    @simphotonics
    Author

    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.

  9. DanTup commented on Nov 27, 2023

    @DanTup
    Member

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

  10. added
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    on Nov 27, 2023
  11. DanTup commented on Nov 27, 2023

    @DanTup
    Member

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

  12. changed the title [-]switch expression snippet does not show after "return" and "=>"[/-] [+]switch expression snippet does not show after "return"[/+] on Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions