🐛 fix(vscode): 代码阅读属性表的输入参数、导入项可以折叠

This commit is contained in:
cruldra committed 2026-09-25 12:20:37 +08:00
1 parent 846fba92e1
commit e8a6a795f5
5 files changed
+55 -15

No files matched your search

@@ -2,7 +2,7 @@ import type { ScrollAnchor } from './scrollPosition'
/**
* 标签页切走时 VS Code 会销毁 webview、切回来重新加载,靠它恢复:哪些块停在「编辑」、
* 哪些块折叠了(块 id 是它在树里的位置,文档刷新后照旧对得上),以及滚到了哪。
* 哪些块和属性行折叠了(块 id 是它在树里的位置,文档刷新后照旧对得上;属性行 id 见 propertyRowId),以及滚到了哪。
*/
export interface ViewState {
editing: string[]
@@ -32,3 +32,11 @@ export function createViewStateStore(storage: ViewStateStorage): ViewStateStore
},
}
}
/**
* 属性表里带子行的那一行(输入参数、导入项)的折叠 id,和块 id 放在同一个 collapsed 里:
* `<块 id>/p<行序号>`,例如 '6.1.0/p3'。块 id 只由数字和点组成,带 '/' 的不会和任何块 id 撞上。
*/
export function propertyRowId(blockId: string, rowIndex: number): string {
return `${blockId}/p${rowIndex}`
}