✨ feat(vscode): 重写注释排成一队,整个扩展一次只跑一段
OpenPencil 同一时间只能开一个画板,两段同时画会互相掐断。所有预览、所有文件的重写(第一轮和接着说)排成一队,前一段写成、出错、被叫停后按先后自动开始下一段;问 AI 照旧最多同时 3 个。 排着的那一轮记在扩展端(rewriteCurrent 的 queued),块下面写「排队中」、能取消排队,切标签页、页面重新加载后照样显示。
This commit is contained in:
1 parent
b7c29c60e1
commit
aecc4d1ab5
15 files changed
+329
-114
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import type { BlockTreeState, RewriteTree } from './BlockTree'
|
||||
import type { ChatState } from './qa'
|
||||
import type { Ask, ChatState } from './qa'
|
||||
import type { BlockView, KindBadge } from './types'
|
||||
import { renderToStaticMarkup } from 'react-dom/server'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
@@ -215,6 +215,18 @@ describe('「注释」一行和「重写注释」按钮', () => {
|
||||
expect(opened).toContain('aria-label="对这段注释的修改意见"')
|
||||
})
|
||||
|
||||
it('展开着又在写或排着队时按钮不能点;出错、停下的不挡', () => {
|
||||
const block = view('6', 'statement', 'save()', { commentTarget: { kind: 'replace', startLine: 0, endLine: 0 } })
|
||||
const button = (status: Ask['status']): string => {
|
||||
const rewrite = { ...EMPTY_CHAT, available: true, open: [block.anchor], asks: [{ askId: 'r1', anchor: block.anchor, question: 'q', text: '', status }] }
|
||||
const markup = renderToStaticMarkup(<BlockLevel blocks={[block]} tree={state(new Set(), rewrite)} />)
|
||||
return /<button[^>]*aria-label="按注释规范重写"[^>]*>/.exec(markup)?.[0] ?? ''
|
||||
}
|
||||
expect(button('running')).toContain('disabled')
|
||||
expect(button('queued')).toContain('disabled')
|
||||
expect(button('stopped')).not.toContain('disabled')
|
||||
})
|
||||
|
||||
it('还没有注释的块:按钮同样在右上角那排,叫「按注释规范写注释」;不能写注释的块没有按钮', () => {
|
||||
inToolbar(html(view('3', 'statement', 'save()', { commentTarget: { kind: 'insert', line: 0 } })), '按注释规范写注释')
|
||||
expect(html(view('4', 'statement', 'save()'))).not.toContain('按注释规范')
|
||||
|
||||
Reference in new issue
Block a user