提交 63c7c90b 编写于 作者: M Matt Bierner

Gate workaround for #52967 to TS 2.9

上级 e1cbd991
......@@ -83,14 +83,16 @@ export class UpdateImportsOnFileRenameHandler {
this.client.bufferSyncSupport.closeResource(targetResource);
this.client.bufferSyncSupport.openTextDocument(document);
// Workaround for https://github.com/Microsoft/vscode/issues/52967
// Never attempt to update import paths if the file does not contain something the looks like an export
const tree = await this.client.execute('navtree', { file: newFile });
const hasExport = (node: Proto.NavigationTree): boolean => {
return !!node.kindModifiers.match(/\bexports?\b/g) || !!(node.childItems && node.childItems.some(hasExport));
};
if (!tree.body || !tree.body || !hasExport(tree.body)) {
return;
if (!this.client.apiVersion.gte(API.v300)) {
// Workaround for https://github.com/Microsoft/vscode/issues/52967
// Never attempt to update import paths if the file does not contain something the looks like an export
const tree = await this.client.execute('navtree', { file: newFile });
const hasExport = (node: Proto.NavigationTree): boolean => {
return !!node.kindModifiers.match(/\bexports?\b/g) || !!(node.childItems && node.childItems.some(hasExport));
};
if (!tree.body || !tree.body || !hasExport(tree.body)) {
return;
}
}
const edits = await this.getEditsForFileRename(targetFile, document, oldFile, newFile);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册