You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To diagnose why the provided code snippet doesn't accept zed --wait as an editor parameter when setting the EDITOR or VISUAL environment variables, we need to consider how the prepareEditorCommand function is implemented. You haven't provided the implementation details for this function, so I will make an educated guess based on common practices.
Potential Issues
Tokenization and Parsing Issue:
If prepareEditorCommand simply splits the editor command based on spaces or uses only the first token, it might not correctly recognize parameters like --wait. When a command with spaces is set (e.g., "zed --wait"), it must be properly parsed into an executable part ("zed") and its arguments ("--wait").
Environment Variables Just Read Executable:
It's possible that prepareEditorCommand is designed only to execute the editor without any arguments. This could mean it doesn't split the string and treats it as a whole executable name, which is not correct because "zed --wait" is not a single executable but rather an executable with an option.
Suggested Solution
Here is how you might want to adjust the prepareEditorCommand function to handle the executable and its arguments properly.
You’d want your prepareEditorCommand to:
Split the editor string by spaces to get the first part as the command and the remaining as its arguments.
Setup the command using the split results to correctly initialize both the executable and its arguments.
Here's a basic approach in Go:
import (
"os/exec""strings"
)
funcprepareEditorCommand(editorstring, filenamestring) *exec.Cmd {
parts:=strings.Fields(editor) // Splits the editor command by spacescmd:=exec.Command(parts[0], append(parts[1:], filename)...) // parts[0] is the command, parts[1:] are the args, added filenamereturncmd
}
This modification takes the entire contents of editor, splits them into a slice where parts[0] is the executable (e.g., "zed") and parts[1:] are all arguments provided (e.g., ["--wait"]). This way, it also appends the filename as the last argument, aligning with usual usage like vim filename.
Verification
After implementing this, ensure that you either directly pass "zed --wait" or set your environment variable correctly (export EDITOR="zed --wait" on Unix-like systems) before running your program to verify that the editor opens as expected with the provided parameters.
The text was updated successfully, but these errors were encountered:
https://github.com/plandex-ai/plandex/blob/a8f88a961e55f7d29ea7e52ce87ff01267349f7b/app/cli/cmd/tell.go#L103C1-L132C1
To diagnose why the provided code snippet doesn't accept
zed --wait
as an editor parameter when setting theEDITOR
orVISUAL
environment variables, we need to consider how theprepareEditorCommand
function is implemented. You haven't provided the implementation details for this function, so I will make an educated guess based on common practices.Potential Issues
Tokenization and Parsing Issue:
prepareEditorCommand
simply splits the editor command based on spaces or uses only the first token, it might not correctly recognize parameters like--wait
. When a command with spaces is set (e.g., "zed --wait"), it must be properly parsed into an executable part ("zed") and its arguments ("--wait").Environment Variables Just Read Executable:
prepareEditorCommand
is designed only to execute the editor without any arguments. This could mean it doesn't split the string and treats it as a whole executable name, which is not correct because "zed --wait" is not a single executable but rather an executable with an option.Suggested Solution
Here is how you might want to adjust the
prepareEditorCommand
function to handle the executable and its arguments properly.You’d want your
prepareEditorCommand
to:editor
string by spaces to get the first part as the command and the remaining as its arguments.Here's a basic approach in Go:
This modification takes the entire contents of
editor
, splits them into a slice whereparts[0]
is the executable (e.g., "zed") andparts[1:]
are all arguments provided (e.g., ["--wait"]). This way, it also appends thefilename
as the last argument, aligning with usual usage likevim filename
.Verification
After implementing this, ensure that you either directly pass
"zed --wait"
or set your environment variable correctly (export EDITOR="zed --wait"
on Unix-like systems) before running your program to verify that the editor opens as expected with the provided parameters.The text was updated successfully, but these errors were encountered: