Files
2026Technology-Competition/src/views/reviewPanel.js
T
范智鹏 d16d680f0f feat: AI 修复链路扩展 + 修复预览两步确认 + 自定义规则/AI 审查条目支持 AI 修复
- AI 修复:无原生 fix 的 linter 条目走 AI 修复(aiFixEngine/fixPrompt,AI 重检收敛),自定义规则与 AI 审查条目新增 AI 修复按钮(customFixEngine),自定义规则条目展开显示 AI 建议(suggestion 字段)

- 修复预览:面板触发修复先用内置 diff 预览,面板内「应用/取消」两步确认后才写入(fixPreview/fixPending,单条与分 tab 批量均支持)

- 修复面板交互:linter/custom/ai 分 tab「全部修复」、已修复+撤销、pending 按钮状态同步

- bug 修复:修复按钮失败后卡  不恢复;custom/ai 修复不稳定(空修复重试、AI 重检收敛判定放宽、降级接受最后一次有效修复)

- 移除 AI codeDiff 展示块
2026-08-20 22:26:30 +08:00

40 lines
1.6 KiB
JavaScript

const vscode = acquireVsCodeApi();
function send(type, line, ruleId, source) {
vscode.postMessage({ type, line, ruleId, source });
}
function switchTab(tabId) {
document.querySelectorAll('.tab').forEach(function(t) { t.classList.remove('active'); });
document.querySelectorAll('.tab-content').forEach(function(tc) { tc.classList.remove('active'); });
document.querySelector('.tab[data-tab="' + tabId + '"]').classList.add('active');
document.getElementById('tab-' + tabId).classList.add('active');
}
function toggleItem(el) {
if (event.target.closest('button')) { return; }
if (event.target.closest('.item-line')) { return; }
el.classList.toggle('expanded');
}
window.addEventListener('message', function(e) {
const msg = e.data;
if (!msg || typeof msg.type !== 'string') { return; }
if (msg.type === 'pending') {
const key = msg.key;
document.querySelectorAll('[data-fix-key="' + key + '"]').forEach(function(btn) {
const isConfirm = btn.classList.contains('btn-apply') || btn.classList.contains('btn-cancel');
btn.style.display = msg.on ? (isConfirm ? '' : 'none') : (isConfirm ? 'none' : '');
if (!msg.on && !isConfirm) {
btn.disabled = false;
if (btn.dataset.label) { btn.textContent = btn.dataset.label; }
}
});
} else if (msg.type === 'batchPending') {
document.querySelectorAll('[data-fix-all-btn]').forEach(function(btn) {
const isConfirm = btn.classList.contains('btn-apply-all') || btn.classList.contains('btn-cancel-all');
btn.style.display = msg.on ? (isConfirm ? '' : 'none') : (isConfirm ? 'none' : '');
});
}
});