✨ feat(vscode): 代码阅读预览里实参值、return 这类一行译文里跨几行写的字典 / 列表按项拆开,各项带自己的实参表

This commit is contained in:
cruldra committed 2026-10-13 13:57:22 +11:00
1 parent b2c5309d1f
commit 907c4092c8
18 files changed
+515 -102

No files matched your search

+12
View File
@@ -351,6 +351,18 @@ describe('blockView', () => {
})
})
it('跨几行写的列表:一行译文下面带拆开的各项,项里的调用带着自己的实参表', async () => {
const source = 'def f(user):\n return [\n Detail(\n id=user.id,\n ),\n user,\n ]\n'
const { blocks: list } = await readBlockViews(runtime, py, pythonZhTranslator, 'python', source, { calleeKind: call => call.callee.text === 'Detail' ? 'class' : undefined })
const returned = list[0].children[0]
expect(translationText(returned)).toBe('返回 列表 2 项')
expect(returned).not.toHaveProperty('table')
expect('items' in returned && returned.items).toMatchObject([
{ cells: [[{ text: '第 1 项' }], [{ text: '新建' }, { text: ' ' }, { text: 'Detail', offset: source.indexOf('Detail') }, { text: ' ' }, { text: '· 1 个参数' }]], table: { columns: ['参数', '值'] } },
{ cells: [[{ text: '第 2 项' }], [{ text: 'user', offset: source.indexOf('user,') }]] },
])
})
it('概念列表:语言的种类在前,语言另认的接着,规则的种类和另认的在后;同一个 id 只留第一个', async () => {
const language: LanguageAdapter = {
...py,