⚡ perf(vscode): 标差异时旧版本的解析结果按旧内容记着,晚到的答案、翻译插件没变就不再重新解析
This commit is contained in:
1 parent
e9c1c67d6f
commit
5a0c5490ea
8 files changed
+87
-8
No files matched your search
@@ -271,6 +271,7 @@ class Preview {
|
||||
this.diff = new PreviewDiff(
|
||||
() => this.from === undefined ? undefined : owner.diffBases.diffBase(document.uri, this.from),
|
||||
source => this.readOld(source),
|
||||
() => this.oldInputs(),
|
||||
diff => this.post({ type: 'diff', diff }),
|
||||
text => logger.add({ level: 'warn', source: 'codeReader', message: `${document.uri.fsPath}:${text}` }),
|
||||
)
|
||||
@@ -452,6 +453,11 @@ class Preview {
|
||||
return message.error === undefined ? { blocks: message.blocks, attributes: message.attributes } : undefined
|
||||
}
|
||||
|
||||
/** 排旧版本除了旧内容还看的(见 readOld):选的翻译插件、项目入口、规则查到的定义和调用的种类变过几次。变了旧版本要重新解析 */
|
||||
private oldInputs(): string {
|
||||
return JSON.stringify([this.registry.selectedTranslator(this.document.languageId)?.id, this.owner.entries.namesOf(this.document.uri), this.lookups.revision, this.callees.revision])
|
||||
}
|
||||
|
||||
/** 这份文档里 offset 处名字的定义是哪种块:语言扩展查到的几处定义里第一处认得出的;语言扩展没答是 undefined。 */
|
||||
private async calleeKind(offset: number): Promise<BlockKind | null | undefined> {
|
||||
const { document } = this
|
||||
|
||||
Reference in new issue
Block a user