🐛 fix(vscode): 重写注释直接调用 /ecc:writing-code-comments,不再自己读技能文件

This commit is contained in:
cruldra committed 2026-10-03 03:22:20 +08:00
1 parent f2490b0505
commit 5f1352df86
3 files changed
+10 -72

No files matched your search

+2 -14
View File
@@ -17,7 +17,7 @@ import { commands, Range, window, workspace, WorkspaceEdit } from 'vscode'
import { logger } from '../../logging/logger'
import { webviewHtml, webviewUiRoot } from '../../webview/html'
import { DocumentCallees } from '../calleeKinds'
import { commentRewritePrompt, commentSource, findPlaced, loadCommentSkill, modelCommentBody, refillComment } from '../commentRewrite'
import { commentRewritePrompt, commentSource, findPlaced, modelCommentBody, refillComment } from '../commentRewrite'
import { PreviewDiff } from '../diff/previewDiff'
import { blockReplacement } from '../editText'
import { locate } from '../folderStore'
@@ -588,19 +588,7 @@ class Preview {
const following = next && next.startLine >= 0 && next.endLine >= next.startLine && next.endLine < document.lineCount
? Array.from({ length: next.endLine - next.startLine + 1 }, (_, i) => document.lineAt(next.startLine + i).text).join('\n')
: undefined
let skill: string | undefined
try {
skill = await loadCommentSkill()
}
catch (err) {
if (!this.rewriteAbort.signal.aborted)
this.failRewrite(`读注释技能失败:${err instanceof Error ? err.message : String(err)}`)
return
}
if (this.rewriteAbort.signal.aborted)
return
const prompt = commentRewritePrompt({
skill,
comment,
source,
startLine: block.startLine,
@@ -609,7 +597,7 @@ class Preview {
...(following !== undefined && { following }),
})
if (!prompt) {
this.failRewrite(skill === undefined ? '找不到写注释的技能' : '这段注释的定界符认不出来,没有改文件。')
this.failRewrite('这段注释的定界符认不出来,没有改文件。')
return
}
const at = locate(document.uri)