Skip to content

Support global evaluation in SDK DAPs #4636

Description

@DanTup

In the old DAPs we supported some basic global evaluation using the root library and the first available isolate. We should support the same in the new SDK DAPs, but ideally use the current open file rather than the root library.

Activity

  1. added
    in debuggingRelates to the debug adapter or process of running debug sessions
    on Jul 10, 2023
  2. added this to the v3.70.0 milestone on Jul 10, 2023
  3. jacob314 commented on Aug 1, 2023

    @jacob314

    What will it take to support evaluating in the context of the library of the currently open file and/or adding some affordance in the UI to select the library to use?

  4. DanTup commented on Aug 1, 2023

    @DanTup
    MemberAuthor

    What will it take to support evaluating in the context of the library of the currently open file

    That's actually what we do :) The comment above didn't mention it, but we pass through the active file in the context (it's non-standard, but all we have for now):

    if (message.command === "evaluate" && message.arguments?.context === "repl") {
    const doc = getActiveRealFileEditor()?.document;
    if (doc && isDartDocument(doc)) {
    message.arguments.context = doc?.uri.toString();
    }
    }

    And then in the debug adapter, we read this and find the relevant library for that script:

    https://github.com/dart-lang/sdk/blob/80a6670d5d081bf6542036979791a8f666adfc1d/pkg/dds/lib/src/dap/adapters/dart.dart#L975

    There's no UI to allow you to select, it just uses the current file. We could change this, although I don't know how nice the UI would be - but you can always open a specific file if you want to use that library.

    What we don't support though is a way to choose the isolate.

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 debuggingRelates to the debug adapter or process of running debug sessionsis bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions