✨ feat(vscode): 代码阅读侧栏可以按审查工单只看 PR 改过的文件:标题栏「选工单」列出看板「审查」列,选中后树里只剩改过的文件(M / A / D 着色),点开的是本机工作副本里 PR 最新的代码,没有就拉 PR 分支建一个,「显示全部」退出

This commit is contained in:
cruldra committed 2026-09-27 17:36:02 +08:00
1 parent c009187f6c
commit 8e2cdfaf17
18 files changed
+1053 -40

No files matched your search

@@ -102,3 +102,36 @@ describe('右键菜单的注释', () => {
expect(itemsFor('view/item/context', 'notes', root)).toEqual([])
})
})
describe('审查工单', () => {
const REVIEWING = 'superpowers.codeReader.reviewing'
const PICK = 'superpowers.codeReader.pickReviewIssue'
const SHOW_ALL = 'superpowers.codeReader.showAllFiles'
it('标题栏:第一个「选工单」,审查时才有「显示全部」,然后「刷新」', () => {
const title = menus['view/title']
.filter(item => item.when.startsWith('view == superpowers.codeReader.files'))
.sort((a, b) => orderOf(a) - orderOf(b))
expect(title.map(item => item.command)).toEqual([PICK, SHOW_ALL, 'superpowers.codeReader.refresh'])
expect(title.every(item => item.group?.startsWith('navigation'))).toBe(true)
expect(title.find(item => item.command === SHOW_ALL)?.when).toContain(`&& ${REVIEWING}`)
expect(title.find(item => item.command === PICK)?.when).not.toContain(REVIEWING)
})
it('按钮的字和图标:选工单 git-pull-request,显示全部 close', () => {
expect(commands.find(item => item.command === PICK)).toMatchObject({ title: '选工单', icon: '$(git-pull-request)' })
expect(commands.find(item => item.command === SHOW_ALL)).toMatchObject({ title: '显示全部', icon: '$(close)' })
})
it('审查时行上没有注释按钮(工作副本里不记注释),复制照旧', () => {
const noteItems = menus['view/item/context'].filter(item => item.command === ADD_NOTE || item.command === EDIT_NOTE)
expect(noteItems.length).toBeGreaterThan(0)
expect(noteItems.every(item => item.when.includes(`!${REVIEWING}`))).toBe(true)
const copyItems = menus['view/item/context'].filter(item => item.submenu === COPY_MENU || item.command?.startsWith('superpowers.codeReader.copy'))
expect(copyItems.some(item => item.when.includes(REVIEWING))).toBe(false)
})
it('命令面板里「显示全部」只在审查时有', () => {
expect(menus.commandPalette.find(item => item.command === SHOW_ALL)?.when).toBe(REVIEWING)
})
})