This commit is contained in:
wassname
2026-04-08 21:06:12 +08:00
parent 1c8cfdd33a
commit a9d9f18bbc
2 changed files with 8 additions and 3 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
# pi-edit-last # pi-edit-last
Edit assistant replies since the last user message in your external editor (Zed, VS Code, etc.). Edit assistant replies since the last user message in your external editor (Zed, VS Code, etc.). Then pi receives your edited version as a revision request.
## Install ## Install
@@ -27,4 +27,4 @@ export VISUAL=zed # or code, vim, etc.
## Related ## Related
- [pi-studio](https://github.com/omaclaren/pi-studio) — Collection of pi extensions - [pi-studio](https://github.com/omaclaren/pi-studio) — web editor
+6 -1
View File
@@ -77,7 +77,12 @@ function buildRevisionPrompt(editedText: string): string {
// Open editor and wait for it to close, returning the edited content // Open editor and wait for it to close, returning the edited content
function editInExternalEditor(content: string): string | null { function editInExternalEditor(content: string): string | null {
const editor = process.env.VISUAL || process.env.EDITOR || "vi"; let editor = process.env.VISUAL || process.env.EDITOR || "vi";
// VSCode needs --wait to block until file is closed
if (editor === "code") {
editor = "code --wait";
}
const tmpDir = mkdtempSync(join(tmpdir(), "pi-edit-")); const tmpDir = mkdtempSync(join(tmpdir(), "pi-edit-"));
const tmpFile = join(tmpDir, "edit.txt"); const tmpFile = join(tmpDir, "edit.txt");