✨ feat(vscode): 代码阅读的调用与构造:跨多行写的调用排成「新建 / 调用 名字 · N 个参数」一行,实参摊成参数 / 值表;Python 查被调用名字的定义分新建和调用,查到后刷新
This commit is contained in:
1 parent
ebf228cdc7
commit
ecc415d763
30 files changed
+1033
-157
No files matched your search
@@ -118,6 +118,21 @@ describe('预览的 document 消息', () => {
|
||||
expect(reports).toEqual(['库规则 fastapi 给筛选属性起名时出错,筛选栏照写 id:词表坏了'])
|
||||
})
|
||||
|
||||
it('调用的名字定义成哪种块交给 calleeKind 问:跨几行新建对象的一行译文下面带实参表', async () => {
|
||||
const source = 'def f(user):\n return Detail(\n id=user.id,\n name=user.name,\n )\n'
|
||||
const asked: string[] = []
|
||||
const { message } = await documentMessage(doc('python', source), registryWithPython(), runtime, ignore, undefined, (call) => {
|
||||
asked.push(call.callee.text)
|
||||
return 'class'
|
||||
})
|
||||
expect(asked).toEqual(['Detail'])
|
||||
expect(message.blocks[0].children[0]).toMatchObject({
|
||||
kind: 'return',
|
||||
translation: [{ text: '返回' }, { text: ' ' }, { text: '新建' }, { text: ' ' }, { text: 'Detail', role: 'type' }, { text: ' ' }, { text: '· 2 个参数', role: 'hint' }],
|
||||
table: { columns: ['参数', '值'], items: [{ cells: [[{ text: 'id' }], expect.anything()] }, { cells: [[{ text: 'name' }], expect.anything()] }] },
|
||||
})
|
||||
})
|
||||
|
||||
it('库规则抛错:不算解析失败,交给 report 记下,这块照常显示', async () => {
|
||||
const broken: LibraryRule = {
|
||||
id: 'broken',
|
||||
|
||||
Reference in new issue
Block a user