Skip to content

Misleading Enum.values type hint #4877

Closed

Description

@incendial

Describe the bug
Hovering over the values getter currently shows the enum type, but is actually a list of values.

enum MyEnum {
  first,
  second,
}

void main() {
  print(MyEnum.values);
}
Screenshot 2023-12-04 at 21 18 53


Given how code navigation works I assume it's all by design, but just in case it's not.

Please complete the following information:

Dart Code extension: 3.78.0

App: Visual Studio Code
App Host: desktop
Version: mac 1.84.2

Workspace type: Dart (LSP)

Dart (3.3.0-91.0.dev): /Users/dimannich/Desktop/flutter/bin/cache/dart-sdk
Flutter (3.17.0-0.0.pre): /Users/dimannich/Desktop/flutter (No device)

Activity

  1. DanTup commented on Dec 4, 2023

    @DanTup
    Member

    Feels like a bug to me. Code completion shows it as a List, so I don't see why we shouldn't here:

    image

    Possibly there's something slightly weird because it's synthetic and navigating will go to the enum itself.

  2. added this to the v3.80.0 milestone on Dec 4, 2023
  3. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    on Dec 4, 2023
  4. modified the milestones: v3.80.0, v3.82.0 on Dec 21, 2023
  5. modified the milestones: v3.82.0, v3.84.0 on Jan 29, 2024
  6. DanTup commented on Feb 7, 2024

    @DanTup
    Member

    Fixed by dart-lang/sdk@bdf4528, ships in the SDK!

  7. added
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    on Feb 7, 2024
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