Command 7: explain the problem(s) at the cursor (read-only — no edits).
(documentUri?: vscode.Uri, range?: vscode.Range)
| 261 | vscode.window.showInformationMessage('QodeX is fixing the problem(s) in the terminal — the file will update on disk when it finishes.'); |
| 262 | } |
| 263 | |
| 264 | /** Command 7: explain the problem(s) at the cursor (read-only — no edits). */ |
| 265 | async function explainDiagnostic(documentUri?: vscode.Uri, range?: vscode.Range): Promise<void> { |
| 266 | const editor = vscode.window.activeTextEditor; |
| 267 | const uri = documentUri ?? editor?.document.uri; |
| 268 | if (!uri) { vscode.window.showWarningMessage('QodeX: no active file.'); return; } |
| 269 | const r = range ?? editor?.selection; |
| 270 | const { text, count } = collectDiagnostics(uri, r ?? undefined); |
| 271 | if (count === 0) { |
| 272 | vscode.window.showInformationMessage('QodeX: no problems at the cursor.'); |
| 273 | return; |
| 274 | } |
| 275 | const prompt = |
| 276 | `Explain these problems in ${uri.fsPath} and how you'd fix them. Do NOT edit anything — just explain clearly:\n\n${text}`; |
| 277 | const cfg = getConfig(); |
| 278 | const term = getOrCreateTerminal(getCwd()); |
| 279 | term.sendText(`${cfg.executablePath} ${cfg.openHeadless ? '--headless ' : ''}${shellQuote(prompt)}`); |
| 280 | } |
| 281 |
nothing calls this directly
no test coverage detected