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! |
| } | ||
|
|
||
| setName(name: string): void { | ||
| this.configuration.name = name; |
There was a problem hiding this comment.
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.
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.
Yes, that's the approach we should use.
There was a problem hiding this comment.
Sounds good, updated.
|
For the API I have created this feature request #80257 |
There was a problem hiding this comment.
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 |
dgozman
left a comment
There was a problem hiding this comment.
Please take another look.
| } | ||
|
|
||
| setName(name: string): void { | ||
| this.configuration.name = name; |
There was a problem hiding this comment.
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:
|
|
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
extensionto 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.