debug: close read-only tabs on end debug session#199898
debug: close read-only tabs on end debug session#199898connor4312 merged 1 commit intomicrosoft:mainfrom
Conversation
|
|
|
Also I'm just thinking about whether it would actually be useful to be able to be able to keep these files open in some scenarios where you are actively working with them and don't want to reopen them for each session. But we could add a setting later, if needed. |
8be6d72 to
83c1e36
Compare
|
@roblourens |
f0d37d2 to
938790c
Compare
I agree. For example when debugging Node.js things, there are internal scripts that don't exist on disk. One can step into them and e.g. set breakpoints in them between debug sessions. I think this behavior should be under a setting (probably off by default?) Link to where debug settings are defined: |
|
I agree re: disabled by default |
938790c to
ca89a93
Compare
|
@microsoft-github-policy-service agree |
|
@connor4312 I added that in the settings. |
ca89a93 to
a4d252c
Compare
| }, | ||
| 'debug.closeReadonlyTabsOnEnd': { | ||
| type: 'boolean', | ||
| description: nls.localize({ comment: ['This is the description for a setting'], key: 'closeReadonlyTabsOnEnd' }, "Automatically close the read-only tabs at the end of a debug session."), |
There was a problem hiding this comment.
I'm not a big fan of this wording, because read-only tabs can come from other places, but I'm not sure how to describe it in a better way without getting superfluous
| this.cancelTokens(session.getId()); | ||
|
|
||
| if (this.configurationService.getValue<IDebugConfiguration>('debug').closeReadonlyTabsOnEnd) { | ||
| const editorsToClose = this.editorService.getEditors(EditorsOrder.SEQUENTIAL).filter(({ editor }) => editor.resource?.scheme === DEBUG_SCHEME && editor.isReadonly); |
There was a problem hiding this comment.
We should make sure the source actually came from the debug session that ended as well to avoid closing the wrong things.
There's a getEncodedDebugData on the Source in debugSource.ts that you can use to extract this information from the editor.resource URI.
|
one more pertinent comment -- sorry, should have noticed that on the first pass too. Then this should be good 👍 |
a4d252c to
601eb9c
Compare
|
Thanks for your review @connor4312 |
The issue: #197949.
The issue was that in a debugging session, user could open some read-only files from the test environment, but when the session ended, there was no need to the read-only tabs to stay open, since the user couldn't edit them and it causes frustration for them.
To test it, you can simply start a debug session and open some read-only files from that debugging environment, like the files in the LOADED_SCRIPTS section and end the session, all the tabs that are read only and opened from the debug context should be closed.