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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not remove documents if they are not files #7607

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/razor/src/document/razorDocumentManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,13 @@ export class RazorDocumentManager implements IRazorDocumentManager {
private closeDocument(uri: vscode.Uri) {
const document = this._getDocument(uri);

// Files outside of the workspace will return undefined from getWorkspaceFolder
const workspaceFolder = vscode.workspace.getWorkspaceFolder(uri);
if (!workspaceFolder) {
// Out of workspace files should be removed once they're closed
this.removeDocument(uri);
// Documents that are files should be removed if they are outside the workspace folder
if (uri.scheme === 'file') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it depends - do you need to close non file documents? Other non-file documents that I know of

  1. Documents just created, but not saved
  2. Diff window files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff window files should also not cause us to remove. It looks like we don't track documents that are just created but not saved.

// Files outside of the workspace will return undefined from getWorkspaceFolder
const workspaceFolder = vscode.workspace.getWorkspaceFolder(uri);
if (!workspaceFolder) {
this.removeDocument(uri);
}
}

this.notifyDocumentChange(document, RazorDocumentChangeKind.closed);
Expand Down
Loading