MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / explainDiagnostic

Function explainDiagnostic

vscode-extension/src/extension.ts:263–278  ·  view source on GitHub ↗

Command 7: explain the problem(s) at the cursor (read-only — no edits).

(documentUri?: vscode.Uri, range?: vscode.Range)

Source from the content-addressed store, hash-verified

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). */
265async 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

Callers

nothing calls this directly

Calls 5

collectDiagnosticsFunction · 0.85
getConfigFunction · 0.85
getOrCreateTerminalFunction · 0.85
getCwdFunction · 0.85
shellQuoteFunction · 0.70

Tested by

no test coverage detected