✨ feat(vscode): 代码阅读预览里工作区外的库文件也能问 AI,问答记进第一个工作区文件夹,重写注释不对库文件开放
This commit is contained in:
1 parent
cecae0e244
commit
39dfd9b084
24 files changed
+463
-79
No files matched your search
@@ -208,6 +208,29 @@ describe('页面重新加载后,调用树弹框照旧开着', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('问 AI 和重写注释各按各的能不能用', () => {
|
||||
const DOC = documentOf(1, [{ ...block('0', 'rglob'), commentTarget: 'replace' }])
|
||||
const qaMessage = (rewritable: boolean): ExtensionToWebview => ({ type: 'qa', available: true, rewritable, threads: [], path: [], subject: 'file', current: [], rewrites: [], rewriteCurrent: [] })
|
||||
const tool = (label: string) => container.querySelector(`[data-id="0"] [aria-label="${label}"]`)
|
||||
|
||||
it('工作区外的库文件(rewritable 为假):块上能问 AI、顶部能问,没有重写注释的按钮', async () => {
|
||||
await load()
|
||||
await deliver(qaMessage(false))
|
||||
await deliver(DOC)
|
||||
expect(tool('问 AI')).not.toBeNull()
|
||||
expect(container.querySelectorAll('.cr-qa')).toHaveLength(1)
|
||||
expect(tool('按注释规范重写')).toBeNull()
|
||||
})
|
||||
|
||||
it('项目里的文件:两个按钮都有', async () => {
|
||||
await load()
|
||||
await deliver(qaMessage(true))
|
||||
await deliver(DOC)
|
||||
expect(tool('问 AI')).not.toBeNull()
|
||||
expect(tool('按注释规范重写')).not.toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('代码配色跟着当前颜色主题', () => {
|
||||
it('扩展端发来的配色设成 body 上的变量:词性的 --cr-<词性>,种类的 --cr-kind-<种类>;换了主题再发来就换', async () => {
|
||||
const style = document.body.style
|
||||
@@ -309,7 +332,7 @@ describe('一条消息只重画受影响的卡片', () => {
|
||||
|
||||
it('没展开、没说过的块下面不画问答区;展开一块只重画那一块', async () => {
|
||||
await load()
|
||||
await deliver({ type: 'qa', available: true, threads: [], path: [], subject: 'file', current: [], rewrites: [], rewriteCurrent: [] })
|
||||
await deliver({ type: 'qa', available: true, rewritable: true, threads: [], path: [], subject: 'file', current: [], rewrites: [], rewriteCurrent: [] })
|
||||
await deliver(copy(DOC))
|
||||
// 顶部那条一直摊开
|
||||
expect(container.querySelectorAll('.cr-qa')).toHaveLength(1)
|
||||
|
||||
Reference in new issue
Block a user