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

[vscode] Implement stubbed API for activeStackFrame API #13900

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

rschnekenbu
Copy link
Contributor

@rschnekenbu rschnekenbu commented Jul 9, 2024

What it does

Implement previously stubbed API for activeStackFrame API (DebugStackFrame & DebugThread)
Fixes #13846

Contributed on behalf of STMicroelectronics

How to test

  1. Install the following extension, that adds the listener on the active Stack item:
  1. Start debugging a project (I ran 2 simple hello world examples in the video)
  2. Switching between stack frames in the Call Stack or to a DebugThread in the Threads view. Information message shall be displayed in the notification area, with the current stack item information.
activestackitem.mp4

We don't have exactly the same interface as in VS Code, so we get more easily the empty stack item message. That should not impact users, as selecting a thread or a stack frame still throws the active stack item change event.

Follow-ups

none

Review checklist

Reminder for reviewers

@rschnekenbu
Copy link
Contributor Author

It seems the 3 Macos tests can't start. That should not block the review however.

Copy link
Contributor

@tsmaeder tsmaeder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be one of the weaker API definitions from the VS Code team. What does "focused" even mean? Some small comments.

@@ -262,6 +269,37 @@ export class DebugExtImpl implements DebugExt {
});
}

set activeStackItem(stackItem: theia.DebugStackFrame | theia.DebugThread | undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should check whether the active item actually changed before sending notifications.

@@ -254,8 +259,12 @@ export class DebugSession implements CompositeTreeElement {
return this._currentThread;
}
set currentThread(thread: DebugThread | undefined) {
if (this._currentThread === thread) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I comparing instances the right thing or should we look at the id?

protected _currentFrame: DebugStackFrame | undefined;
get currentFrame(): DebugStackFrame | undefined {
return this._currentFrame;
}
set currentFrame(frame: DebugStackFrame | undefined) {
if (this._currentFrame === frame) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, is there only ever one copy of the same frame?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code should update the existing one instead of creating new ones (see

const frame = this._frames.get(id) || new DebugStackFrame(this, this.session);
). But comparing identifiers may be more robust indeed.

I pushed a new commit to address the issue.

@rschnekenbu
Copy link
Contributor Author

This seems to be one of the weaker API definitions from the VS Code team. What does "focused" even mean? Some small comments.

Yes, a surprising API. In this case, 'focus' means what is current selection in the UI from what I can see from VS Code 🤷

fixes eclipse-theia#13846

contributed on behalf of STMicroelectronics
@rschnekenbu rschnekenbu merged commit 1a08090 into eclipse-theia:master Jul 25, 2024
11 of 14 checks passed
@rschnekenbu rschnekenbu deleted the issues/13846 branch July 25, 2024 08:12
@sgraband sgraband added this to the 1.52.0 milestone Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[vscode] Implement stubbed DebugStackFrame and DebugThread API
3 participants