♻️ refactor(vscode): 卡片里的子块只留挂在子行上、点了才展开的一种,测试假数据换掉旧 React 卡片的名字
This commit is contained in:
1 parent
f6bc217e91
commit
5e994cd90e
16 files changed
+121
-130
No files matched your search
@@ -114,21 +114,14 @@ export function foldUnchanged(blocks: readonly BlockView[], tree: DiffTree, show
|
||||
}
|
||||
close()
|
||||
}
|
||||
/** 一层子块:放进父卡片里的按所在的行分开折(各画在各的地方),点子行才展开的不折、只往里看改动 */
|
||||
/** 一层子块:挂在父卡片子行上、点子行才展开的不折、只往里看改动,别的照常折 */
|
||||
function visit(list: readonly BlockView[], owner: string): void {
|
||||
const breaks = new Set((tree.removed.get(owner) ?? []).map(item => item.after))
|
||||
const places = new Map<string, BlockView[]>()
|
||||
for (const block of list) {
|
||||
if (block.slot?.item !== undefined) {
|
||||
if (tree.changes.has(block.id) || kept(block))
|
||||
visit(block.children, block.id)
|
||||
continue
|
||||
}
|
||||
const place = block.slot ? `${block.slot.row}` : ''
|
||||
places.set(place, [...places.get(place) ?? [], block])
|
||||
if (block.slot && (tree.changes.has(block.id) || kept(block)))
|
||||
visit(block.children, block.id)
|
||||
}
|
||||
for (const group of places.values())
|
||||
visitRun(group, breaks)
|
||||
visitRun(list.filter(block => !block.slot), breaks)
|
||||
}
|
||||
visit(blocks, '')
|
||||
return { runs, folded }
|
||||
@@ -137,7 +130,7 @@ export function foldUnchanged(blocks: readonly BlockView[], tree: DiffTree, show
|
||||
/**
|
||||
* 「上一处 / 下一处」和总览条上的一处改动:新增的最外面那块、自己改了的修改块、删掉的块,照页面上的先后。
|
||||
* id 是页面上的块 id(删掉的块是 PlacedRemoved.id);from / to 是它在新文件里的行(0 起),修改块只算它自己那几行(到第一个子块之前);
|
||||
* ancestors 是要展开才看得见它的各层块和属性行(放进父卡片里的子块要展开它所在的那一行,见 unfoldToShow)。
|
||||
* ancestors 是要展开才看得见它的各层块和属性行(挂在父卡片子行上的子块要展开它所在的那一行和它自己,见 unfoldToShow)。
|
||||
*/
|
||||
export interface ChangeStop {
|
||||
id: string
|
||||
|
||||
Reference in new issue
Block a user