Command 3: tell QodeX to edit the current file.
()
| 131 | |
| 132 | /** Command 3: tell QodeX to edit the current file. */ |
| 133 | async function editCurrentFile(): Promise<void> { |
| 134 | const editor = vscode.window.activeTextEditor; |
| 135 | if (!editor) { |
| 136 | vscode.window.showWarningMessage('QodeX: no active editor.'); |
| 137 | return; |
| 138 | } |
| 139 | const filePath = editor.document.uri.fsPath; |
| 140 | const what = await vscode.window.showInputBox({ |
| 141 | prompt: `What change should QodeX make to ${path.basename(filePath)}?`, |
| 142 | placeHolder: 'e.g. add error handling, refactor to async/await, add JSDoc', |
| 143 | }); |
| 144 | if (!what) return; |
| 145 | const cfg = getConfig(); |
| 146 | const cwd = getCwd(); |
| 147 | const term = getOrCreateTerminal(cwd); |
| 148 | const promptText = `Edit ${filePath}: ${what}. Read the file first, then make the change. Verify by running typecheck/lint if available.`; |
| 149 | term.sendText(`${cfg.executablePath} ${shellQuote(promptText)}`); |
| 150 | } |
| 151 | |
| 152 | /** Command 4: plan a change. */ |
| 153 | async function runPlan(): Promise<void> { |
nothing calls this directly
no test coverage detected