提交 b7dcf277 编写于 作者: M Matt Bierner

Make sure we have closed old resources before performing rename

上级 a8ebc3fb
...@@ -216,8 +216,7 @@ export default class BufferSyncSupport { ...@@ -216,8 +216,7 @@ export default class BufferSyncSupport {
this.requestDiagnostic(resource); this.requestDiagnostic(resource);
} }
private onDidCloseTextDocument(document: TextDocument): void { public closeResource(resource: Uri): void {
const resource = document.uri;
const syncedBuffer = this.syncedBuffers.get(resource); const syncedBuffer = this.syncedBuffers.get(resource);
if (!syncedBuffer) { if (!syncedBuffer) {
return; return;
...@@ -230,6 +229,10 @@ export default class BufferSyncSupport { ...@@ -230,6 +229,10 @@ export default class BufferSyncSupport {
} }
} }
private onDidCloseTextDocument(document: TextDocument): void {
this.closeResource(document.uri);
}
private onDidChangeTextDocument(e: TextDocumentChangeEvent): void { private onDidChangeTextDocument(e: TextDocumentChangeEvent): void {
const syncedBuffer = this.syncedBuffers.get(e.document.uri); const syncedBuffer = this.syncedBuffers.get(e.document.uri);
if (syncedBuffer) { if (syncedBuffer) {
......
...@@ -71,6 +71,7 @@ export class UpdateImportsOnFileRenameHandler { ...@@ -71,6 +71,7 @@ export class UpdateImportsOnFileRenameHandler {
} }
// Make sure TS knows about file // Make sure TS knows about file
this.bufferSyncSupport.closeResource(oldResource);
this.bufferSyncSupport.openTextDocument(document); this.bufferSyncSupport.openTextDocument(document);
const edits = await this.getEditsForFileRename(document, oldFile, newFile); const edits = await this.getEditsForFileRename(document, oldFile, newFile);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册