♻️ refactor(vscode): 代码阅读的块数据去掉没人用的「注释」一行下标 commentRow

This commit is contained in:
cruldra committed 2026-10-08 08:04:51 +08:00
1 parent ebea984852
commit 5cf96af740
6 files changed
+15 -27

No files matched your search

+4 -4
View File
@@ -396,7 +396,7 @@ describe('卡片上的「注释」一行', () => {
const list = await views(py, 'python', pythonZhTranslator, source)
expect(list.some(view => view.kind === 'comment')).toBe(false)
const repo = list.find(view => view.kind === 'class')
expect(repo).toMatchObject({ startLine: 12, headerEndLine: 20, commentRow: 1, commentTarget: { kind: 'replace', startLine: 12, endLine: 15 } })
expect(repo).toMatchObject({ startLine: 12, headerEndLine: 20, commentTarget: { kind: 'replace', startLine: 12, endLine: 15 } })
expect('properties' in repo! && repo.properties.map(row => row.label).slice(0, 3)).toEqual(['名称', '注释', '访问级别'])
expect(commentText(repo)).toBe([
'luffy_agent.user.models.User 在各方法体内按需局部导入 (非模块顶层):',
@@ -435,11 +435,11 @@ describe('卡片上的「注释」一行', () => {
const [, load] = await views(ts, 'typescript', typescriptZhTranslator, source)
expect('properties' in load && load.properties.map(row => row.label).slice(0, 4)).toEqual(['名称', '说明', '注释', '访问级别'])
expect(commentText(load)).toBe('讲 load\n\n第二段')
expect(load).toMatchObject({ startLine: 2, commentRow: 2, commentTarget: { kind: 'replace', startLine: 2, endLine: 4 } })
expect(load).toMatchObject({ startLine: 2, commentTarget: { kind: 'replace', startLine: 2, endLine: 4 } })
const [check, returned] = load.children
expect(check).toMatchObject({ kind: 'if', startLine: 7, commentRow: 0, rows: [{ label: '注释', value: { markdown: '先检查' } }] })
expect(check).toMatchObject({ kind: 'if', startLine: 7, rows: [{ label: '注释', value: { markdown: '先检查' } }] })
expect(returned).toMatchObject({ kind: 'return', commentTarget: { kind: 'insert', line: 11 } })
expect(returned).not.toHaveProperty('commentRow')
expect(returned).not.toHaveProperty('rows')
})
it('嵌着的代码里的块不能写注释:没有 commentTarget', async () => {