Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the DAP "invalidated" event #106745

Closed
weinand opened this issue Sep 15, 2020 · 8 comments
Closed

Implement the DAP "invalidated" event #106745

weinand opened this issue Sep 15, 2020 · 8 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded

Comments

@weinand
Copy link
Contributor

weinand commented Sep 15, 2020

A new InvalidatedEvent has been added to the DAP:

/** Event message for 'invalidated' event type.
This event signals that some state in the debug adapter has changed and requires that the client needs to re-render the data snapshot previously requested.
Debug adapters do not have to emit this event for runtime changes like stopped or thread events because in that case the client refetches the new state anyway. But the event can be used for example to refresh the UI after rendering formatting has changed in the debug adapter.
This event should only be sent if the debug adapter has received a value true for the 'supportsInvalidatedEvent' capability of the 'initialize' request.
*/
export interface InvalidatedEvent extends Event {
// event: 'invalidated';
body: {
/** Optional set of logical areas that got invalidated. If this property is missing or empty, a single value 'all' is assumed. */
areas?: InvalidatedAreas[];
/** If specified, the client only needs to refetch data related to this thread. */
threadId?: number;
/** If specified, the client only needs to refetch data related to this stack frame (and the 'threadId' is ignored). */
stackFrameId?: number;
};
}

This feature request asks for handling the event in VS Code and sending the corresponding supportsInvalidatedEvent property in the initialize request.

@weinand weinand added feature-request Request for new features or functionality debug Debug viewlet, configurations, breakpoints, adapter issues labels Sep 15, 2020
@weinand weinand added this to the September 2020 milestone Sep 15, 2020
@weinand weinand removed their assignment Sep 18, 2020
@weinand
Copy link
Contributor Author

weinand commented Sep 18, 2020

@isidorn I've added the new InvalidatedEvent to VS Code's debugProtocol.d.ts.

@isidorn
Copy link
Contributor

isidorn commented Sep 21, 2020

Great. I can look into adding this. For now this event on the VS Code side would refresh the corresponding InvalidatedAreas and would probably automatically re-evaluate all watch expressions?
Also I am not sure if we need a different event for stacks and threads?

@weinand
Copy link
Contributor Author

weinand commented Sep 21, 2020

@isidorn yes, reevaluating the watches makes sense because watches are unknown to the DAP.

different event for stacks and threads

Yes, for VS Code stacks and threads are combined in one UI, but for other clients that might not be the case.

@isidorn
Copy link
Contributor

isidorn commented Sep 21, 2020

Related DAP request microsoft/debug-adapter-protocol#128

@weinand
Copy link
Contributor Author

weinand commented Sep 21, 2020

I've released "invalidated" event support in Mock debug. Just use the context menu action "Toggle between decimal and hex formatting".

@isidorn
Copy link
Contributor

isidorn commented Sep 21, 2020

I have pushed a first version of this and it seems to work just fine.
Try it out and let me know how it goes

fyi @gregg-miskelly @testforstephen

recording (2)

@isidorn isidorn closed this as completed Sep 21, 2020
isidorn added a commit that referenced this issue Sep 21, 2020
@isidorn isidorn added the verification-needed Verification of issue is requested label Sep 21, 2020
meganrogge pushed a commit to meganrogge/vscode that referenced this issue Sep 22, 2020
@weinand weinand changed the title Implement the DAP Invalidate request Implement the DAP "invalidated" event Sep 23, 2020
@testforstephen
Copy link

Have a quick try on this new event, it works well. Thanks for your amazing work. @weinand @isidorn

After i change the formatter setting, then send an invalidatedEvent to client, the whole variables view will be refreshed. One drawback is the Variables menu doesn't support icon. If icon is allowed, it's very easy to express the toggle effect since most of my formatter options are boolean. This is out of scope of this issue. If icon is viable, i can create a new issue for it.

refreshVariables

@isidorn
Copy link
Contributor

isidorn commented Sep 28, 2020

@testforstephen thanks a lot for trying it out. Based on your comment adding verified label.
As for the icons -> we do not support them, and we can not support them (electron does not support icons in native context menus). Though feel free to file a feature reuqest (though there might be something open already, I am not sure)

@isidorn isidorn added the verified Verification succeeded label Sep 28, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Nov 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants