Skip to content

Support "Inline Values" when debugging #5426

Closed

Description

@DanTup

There's an issue in the SDK for the server implementation of this, but we should ensure it's called out in release notes here.

dart-lang/sdk#59891

Basic implementation for variables/parameters looks like this:

inlinevalues.mp4

Feedback should be collected in dart-lang/sdk#59891

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Feb 24, 2025
  2. added this to the v3.108.0 milestone on Feb 24, 2025
  3. added
    in editorRelates to code editing or language features
    in lsp/analysis serverSomething to be fixed in the Dart analysis server
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    on Feb 24, 2025
  4. DanTup commented on Feb 27, 2025

    @DanTup
    MemberAuthor

    This is supported for variables via dart-lang/sdk@2cc6b61, ships in the SDK.

  5. FMorschel commented on Mar 11, 2025

    @FMorschel
    Contributor

    I have two points to consider here:

    1. Some types are not showing (I think this is expected) but we could do the same as for watch line:

    Image

    1. I think it is a bit weird that the value for node is showing up on a line that was never executed:

    Image

  6. DanTup commented on Mar 11, 2025

    @DanTup
    MemberAuthor

    @FMorschel where is your execution pointers for (1)? If type is also used further down, it will only show on the last instance of the identifier.

    For (2), I guess this is where the simple rule of "the last instance of an identifier" doesn't look so good. It's possible for this case we could figure out you're in the else and exclude the other branches, however I don't know if it's guaranteed that a client would give us a completely accurate position of execution and I suspect even if we did that, there may be other cases that do something similar.

    Even if we said we'd show against all instances of an identifier, it might still look odd if we show on branches that weren't taken. I think this needs some more thought (and I will try and test out some other languages to see what they do - it's possible this is common).

  7. FMorschel commented on Mar 11, 2025

    @FMorschel
    Contributor

    where is your execution pointers for (1)? If type is also used further down, it will only show on the last instance of the identifier.

    Ops, the first line in the method already uses it, you are right. Thanks!

    I will try and test out some other languages to see what they do - it's possible this is common

    Thanks!

  8. FMorschel commented on Mar 21, 2025

    @FMorschel
    Contributor

    For (2), I guess this is where the simple rule of "the last instance of an identifier" doesn't look so good.

    I think it is completely lost on switch cases, never entered neither case here:

    Image

  9. DanTup commented on Mar 24, 2025

    @DanTup
    MemberAuthor

    Yeah, the issue here is really about what we do with branches that we don't know if were taken. Here's a simpler example of the issue:

    Image

    Here, the analysis server has no idea whether the if condition matched or not, so it has no idea if that instance of i was actually part of executing code.

    I think it would be useful to compare other languages that support this feature - I have split this into #5454 as somewhere to discuss.

  10. orestesgaolin commented on Apr 1, 2025

    @orestesgaolin

    Is this going to be available with next stable? I wonder what are the differences between VS Code extension provided inline values vs this generic setting debug.inlineValues (which worked way before 3.29)

    Image

    Image

  11. DanTup commented on Apr 1, 2025

    @DanTup
    MemberAuthor

    Is this going to be available with next stable?

    For variables/parameters, yep! Getters is still behind a flag because I want to be sure we're not being too noisy or triggering lots of side-effects before having that on by default.

    I wonder what are the differences between VS Code extension provided inline values vs this generic setting debug.inlineValues (which worked way before 3.29)

    When I previously tried it, the VS Code version (which has no understanding of the language) had some awkward quirks, like showing in unrelated functions - see microsoft/vscode#60150. By doing it in the language server, we have more control over where these appear (or don't). We also currently only show the last instance of a given value to try to reduce the noise (for example your screenshot above shows multiple copies value that all have the same value, but confusing are not the value of that variable when execution was that line. When the server provides these, you'd only get the one on line 146.

  12. orestesgaolin commented on Apr 1, 2025

    @orestesgaolin

    That explains it.

    Just one more question - Will the new annotation (based on language-server) be fed into default VS Code's debug feature? Or should I switch to Flutter/Dart-Code setting once it's supported by my Flutter version?

  13. DanTup commented on Apr 1, 2025

    @DanTup
    MemberAuthor

    Yep, VS Code will automatically ask the language server for inline values when the server says it supports them. Otherwise (if your setting is on) it will infer them. So there should be nothing to do - you'll just get them from the language server after upgrading.

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