🐛 fix(vscode): 代码阅读 ⌘ 悬停每次现问定义,语言扩展启动后就能链上、点击总去跳
This commit is contained in:
1 parent
d412f4f01e
commit
ea5935135b
7 files changed
+204
-71
No files matched your search
@@ -180,21 +180,21 @@ class Preview {
|
||||
this.visibleLine = msg.line
|
||||
return
|
||||
case 'probeDefinition':
|
||||
await this.probeDefinition(msg.version, msg.offset)
|
||||
await this.probeDefinition(msg.id, msg.version, msg.offset)
|
||||
return
|
||||
case 'goToDefinition':
|
||||
await this.goToDefinition(msg.version, msg.offset)
|
||||
}
|
||||
}
|
||||
|
||||
/** 回答 webview:offset 处的名字有没有定义。下标属于别的文档版本时不答,webview 收到新文档后会重新问 */
|
||||
private async probeDefinition(version: number, offset: number): Promise<void> {
|
||||
/** 回答 webview 第 id 次询问:offset 处的名字有没有定义。下标属于别的文档版本时不答,webview 收到新文档后会重新问 */
|
||||
private async probeDefinition(id: number, version: number, offset: number): Promise<void> {
|
||||
const { document } = this
|
||||
if (version !== document.version)
|
||||
return
|
||||
const found = await hasDefinition(document.uri, document.positionAt(offset))
|
||||
if (version === document.version && this.ready)
|
||||
this.post({ type: 'definitionProbed', version, offset, found })
|
||||
this.post({ type: 'definitionProbed', id, found })
|
||||
}
|
||||
|
||||
/** ⌘ / Ctrl + 点击:跳到 offset 处名字的定义,几处时先让用户挑。 */
|
||||
|
||||
Reference in new issue
Block a user