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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline chat holds on to untitled documents (part 2) #203510

Closed
jrieken opened this issue Jan 26, 2024 · 3 comments
Closed

Inline chat holds on to untitled documents (part 2) #203510

jrieken opened this issue Jan 26, 2024 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues inline-chat insiders-released Patch has been released in VS Code Insiders verified Verification succeeded workbench-untitled-editors Managing of untitled editors in workbench window
Milestone

Comments

@jrieken
Copy link
Member

jrieken commented Jan 26, 2024

this is a long-ish demo of a potential 馃悰 that is still of happening:

  • when the file becomes dirty (ie, copilot writes some code), closing out and dismissing the save will not increment the untitled names (what was mentioned in this issue).
  • But when copilot doesn't write code, closing it out and using ctrl+n again for a new file opens a file with the name Untitled-2 (increments the untitled name)
Screen.Recording.2024-01-25.at.9.30.16.PM.mov

Originally posted by @justschen in #203448 (comment)

@jrieken jrieken self-assigned this Jan 26, 2024
@jrieken jrieken added inline-chat freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues labels Jan 26, 2024
@jrieken jrieken added this to the February 2024 milestone Jan 26, 2024
@jrieken jrieken added the bug Issue identified by VS Code Team member as probable bug label Jan 26, 2024
@jrieken
Copy link
Member Author

jrieken commented Jan 26, 2024

@bpasero I need you input here. Today, I listen to untitled document becoming non-dirty but in this case it never was dirty. It feels like I am missing an event. Do I need use the events of editor tabs to see if no tab exists anymore?

@bpasero bpasero self-assigned this Jan 26, 2024
@bpasero
Copy link
Member

bpasero commented Jan 26, 2024

Lets talk when we are both in the office, there is something in the untitled land that I was planning to change in debt land that could be related.

The rule for incrementing the counter for untitled files is based on whether an untitled model still exists:

let counter = 1;
do {
untitledResource = URI.from({ scheme: Schemas.untitled, path: `Untitled-${counter}` });
counter++;
} while (this.mapResourceToModel.has(untitledResource));

So maybe someone still holds a reference to the untitled file and thus it does not get disposed. Remember that last milestone I had changed untitled models to be strictly disposable only when the last reference is disposed, even on revert.

@bpasero bpasero added the workbench-untitled-editors Managing of untitled editors in workbench window label Jan 26, 2024
@jrieken
Copy link
Member Author

jrieken commented Jan 26, 2024

So maybe someone still holds a reference to the untitled file and thus it does not get disposed.

馃檵 that's me and the culprit of this issue. Inline chat creates references to the models it uses. That's because when changing between editor tabs I need to hold on to things. This is also true for closing but when closing non-dirty untitled editor I want to release sessions (e.g stop preventing to dispose them)

jrieken added a commit that referenced this issue Jan 30, 2024
@VSCodeTriageBot VSCodeTriageBot added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jan 30, 2024
@alexr00 alexr00 added the verified Verification succeeded label Feb 22, 2024
@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues inline-chat insiders-released Patch has been released in VS Code Insiders verified Verification succeeded workbench-untitled-editors Managing of untitled editors in workbench window
Projects
None yet
Development

No branches or pull requests

4 participants