✨ feat(vscode): 代码阅读的输入参数排成带表头和边框的表格

This commit is contained in:
cruldra committed 2026-09-26 16:15:59 +08:00
1 parent 6416cdf714
commit 83adefdf5e
10 files changed
+197 -24

No files matched your search

@@ -0,0 +1,16 @@
import type { Inline, PropertyItem, PropertyRow } from './types'
/**
* 一行下面展开的子行怎么排:翻译插件给了列名的(输入参数)排成带表头和边框的表格,没给的(导入项、字典 / 对象的各项)排成列表;
* 没有子行就什么都不展开。
*/
export function subRowsLayout(row: PropertyRow): 'table' | 'list' | undefined {
if (!row.items?.length)
return undefined
return row.columns ? 'table' : 'list'
}
/** 表格里一个子行的格子:按列名的列数取,子行少给的格子留空、多给的不显示。 */
export function tableCells(item: PropertyItem, columns: string[]): Inline[][] {
return columns.map((_, i) => item.cells[i] ?? [])
}