-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Make DebugSession.name writable; fixes #79583 #80122
Conversation
@dgozman thanks for this PR, I think this direction makes sense but I will also consult with @weinand tomorrow. As for the API, this would be a minor API update, so I think we can keep the process about adding new API to the minimum and I can take care of that. Regarding the actuall code changes I have left comments in the code directly. Thanks a lot! |
@@ -108,6 +110,11 @@ export class DebugSession implements IDebugSession { | |||
return includeRoot && this.root ? `${this.configuration.name} (${resources.basenameOrAuthority(this.root.uri)})` : this.configuration.name; | |||
} | |||
|
|||
setName(name: string): void { | |||
this.configuration.name = name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think we should change the underlying configuration
object.
This to me feels like we should introduce a new attribute on the session called name
.
And in the getLabel
we use the name
of the session, if the name
is not defined then go back to providing the configuration.name
as a fallback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That way we have two independt attributes, and we do not mix concepts between the name of the configuration and the name of the session.
Let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's the approach we should use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, updated.
For the API I have created this feature request #80257 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is missing from the PR is the change propagation from VS Code into an extension. Use case: one extension updates a session's name. This flows nicely back into VS Code and updates the UI but the name change is not propagated to debug session copies that might live in other extensions.
To make this API complete, we would actually need listener API for tracking the name changes of debug sessions.
After discussing this in the API sync we agreed:
@dgozman so it would be great if you tackle my comments in the code and we can merge this in. Thanks a lot |
Thank you for looking at this, I will address all comments. One question on the last comment.
I wanted to do that, but wasn't sure about objects relationship. It seems that MainThreadDebugService has a single |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take another look.
@@ -108,6 +110,11 @@ export class DebugSession implements IDebugSession { | |||
return includeRoot && this.root ? `${this.configuration.name} (${resources.basenameOrAuthority(this.root.uri)})` : this.configuration.name; | |||
} | |||
|
|||
setName(name: string): void { | |||
this.configuration.name = name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, updated.
@dgozman thanks a lot for addressing my initial feedback. Great for the testing branch. Once you wrap up the changes can you test everything again just so we are sure all is good. I will also test it before merging. Things to keep an eye on when testing:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isidorn Thanks, I have addressed the feedback. All the cases you mentioned work for me locally, including the two extensions case. I also checked the loaded sources view, and it does update as well.
This works great, I have tested this out and I have found only one issue which I have captured here #80379 Thanks a lot for this PR, nice work! |
Thank you, I will look at #80379. |
@isidorn I took a stub on issue #79583, could you please take a look? Do you think this is a right direction?
I thought about constraining the name setter only to the extension which provides the debugger type for this DebugSession, but wasn't able to get a hold on
extension
to implement this check. Any thoughts?This is changing extension API, so perhaps this process applies? I am not sure how I can follow up there.
Here is a branch I used for testing, it defines "Rename active session" command.