mirror of
https://github.com/wassname/pi-edit-last.git
synced 2026-06-27 16:16:08 +08:00
working
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|||||||
Reference in New Issue
Block a user