⚡ perf(vscode): 代码阅读预览发给页面的块带内容指纹:扩展端按卡片内容、在源码里占的地方连同子块的指纹算摘要,页面按指纹认出没变的块沿用原来的对象,不再逐块深比内容,5126 行的文档到了比对 10.6ms → 0.4ms

This commit is contained in:
cruldra committed 2026-10-13 16:39:59 +11:00
1 parent ad5f559e92
commit 266dc42bc5
13 files changed
+194 -26

No files matched your search

+3 -3
View File
@@ -22,7 +22,7 @@ import { createPageStore } from './pageState'
import { NO_PLACEMENT, placementOf } from './placement'
import { chatOf, PATH_ASK_ANCHOR, sameChat } from './qa'
import { TextMarksContext } from './SegmentText'
import { shareUnchanged } from './sharing'
import { shareBlocks, shareUnchanged } from './sharing'
import { StickyLines } from './StickyLines'
import { createStore, useStore } from './store'
import { useChangeNav } from './useChangeNav'
@@ -151,8 +151,8 @@ export function App(): ReactElement | null {
case 'document': {
const restoring = restoreCall.current
restoreCall.current = undefined
// 和上一份内容一样的块还是原来的对象:没变的卡片不重画
const next = shareUnchanged(page.get().doc, msg)
// 指纹没变的块还是原来的对象:没变的卡片不重画
const next = { ...msg, blocks: shareBlocks(page.get().doc?.blocks, msg.blocks) }
const reopened = restoring && openingCall(next, restoring.anchor, restoring.entry)
marks.set(current => ({ ...current, names: nameMap(msg.names), placement: placementOf(next.blocks) }))
page.update(current => ({