Skip to content

Show all function exit points by clicking on return or the return type #4844

Closed

Description

@lukehutch

Is your feature request related to a problem? Please describe.

Eclipse has a nice feature where clicking on either a return statement or the return type of a function, all the exit points of the function are highlighted (whether they are return statements, throw statements, etc.).

Dart doesn't have checked exceptions, so doing this in Dart won't give the user a complete view of all the ways a function can exit (well, to be fair, Java also has unchecked exceptions, so it's not complete for Java either) -- but even being able to easily spot most of the return points in Dart would be really helpful.

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Nov 18, 2023
  2. added this to the On Deck 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. DanTup commented on Nov 20, 2023

    @DanTup
    Member

    TypeScript does this too:

    image

    There's some discussion about changing how occurrences are computed to fix some issues with .new in #4670 so maybe it makes sense to try and handle these together.

  5. DanTup commented on Feb 17, 2025

    @DanTup
    Member

    Interestingly, TypeScript excludes throws that are inside try if there is a catch:

    Image

    I think to do the same in Dart we'd need to check whether the type being thrown is caught by a catch (since in Dart they can have types on them).

  6. modified the milestones: On Deck, v3.108.0 on Feb 17, 2025
  7. modified the milestones: v3.108.0, On Deck on Mar 11, 2025
  8. DanTup commented on Aug 12, 2025

    @DanTup
    Member

    This has recently been implemented via dart-lang/sdk#61170

    It'll ship in an upcoming SDK.

  9. added
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    on Aug 12, 2025
  10. lukehutch commented on Aug 12, 2025

    @lukehutch
    Author

    Psyched for this. Thank you!

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 enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.relies 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