-
Notifications
You must be signed in to change notification settings - Fork 28k
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
Inline chat widget not disposed when closing untitled editor with pending edits #192356
Comments
@jrieken yeah, untitled working copies are always self-disposing upon vscode/src/vs/workbench/services/untitled/common/untitledTextEditorModel.ts Lines 282 to 285 in 0c5c400
Would it make sense to listen to the dispose of models as well to clean up? How does it work today when you open a normal text file and close the editor? |
When that happens the controller gets disposed which can then do the cleanup of the resources it acquired. (There is actually a corner-case in which this doesn't happen but it can be fixed at the right place)
This would be very hard because the whole design is based on acquiring a reference and releasing that. Assuming "bottom up freeing" isn't a good fit in that model, it basically raises the question why we acquire and release references in the first place. Also the code must than assume that disposal can happen at any time and for instance teardown the UI, discard edits etc pp. So, I'd rather prefer to see untitled files/editor behave like other models and also use the ref-counting model so that down-level code doesn't have to know about special cases like this |
… wait for SM), enable leak checks in test re #192356 (comment) re #190503
The current behaviour is historic and from a time before we had the resolver service and ref-counted models. We can try to change this behaviour but I am bit worried about regressions. This opens up the ability to have a untitled model in memory without associated editor, which we never had so far. On the other hand, we allow this for normal file based editors, so it might be just fine. We still forcefully open any dirty model as editor to indicate unsaved work to the user, and we need to ensure that this still works when we introduce ref-counting down there. I am exploring what this would mean in https://github.com/microsoft/vscode/tree/ben/untitled-ref-count but will probably not make more progress until next debt week. An idea would be to let |
…he UI and release its session so that a fresh run is possible re #192356, re microsoft/vscode-copilot-release#391
… wait for SM), enable leak checks in test re microsoft#192356 (comment) re microsoft#190503
…he UI and release its session so that a fresh run is possible re microsoft#192356, re microsoft/vscode-copilot-release#391
A consequence of this change (in #194371) is that when you open an untitled document via: vscode.workspace.openTextDocument({
content: ''
}).then((doc) => {
vscode.window.showTextDocument(doc);
}); And then close it without making a change, the model will stay around because it is not being reverted in that case because it is not dirty. As such this never fires:
Not sure how bad this is in real world scenarios, but we might need to revisit that particular case. |
Yeah, let's see but we always and everywhere stated that closing documents in entirely up to the editor |
The text was updated successfully, but these errors were encountered: