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

Make sure we have closed old resources before performing rename

上级 a8ebc3fb
......@@ -216,8 +216,7 @@ export default class BufferSyncSupport {
this.requestDiagnostic(resource);
}
private onDidCloseTextDocument(document: TextDocument): void {
const resource = document.uri;
public closeResource(resource: Uri): void {
const syncedBuffer = this.syncedBuffers.get(resource);
if (!syncedBuffer) {
return;
......@@ -230,6 +229,10 @@ export default class BufferSyncSupport {
}
}
private onDidCloseTextDocument(document: TextDocument): void {
this.closeResource(document.uri);
}
private onDidChangeTextDocument(e: TextDocumentChangeEvent): void {
const syncedBuffer = this.syncedBuffers.get(e.document.uri);
if (syncedBuffer) {
......
......@@ -71,6 +71,7 @@ export class UpdateImportsOnFileRenameHandler {
}
// Make sure TS knows about file
this.bufferSyncSupport.closeResource(oldResource);
this.bufferSyncSupport.openTextDocument(document);
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.
先完成此消息的编辑!
想要评论请 注册