Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when returning the output, add a # prefix if missing #118

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions scripts/bash_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ create_completion()
# Get the text typed until now
text=${READLINE_LINE}
completion=$(echo -n "$text" | $CODEX_CLI_PATH/src/codex_query.py)

# add # to the beginning of $text if it doesnt start with #
# get the first non whitespace char
# first_char=$(echo $line | sed -e 's/^[[:space:]]*//')
# get the first char of the line
first_char=$(echo $text | cut -c 1)
if [ "$first_char" != "#" ]; then
text="# $text"
fi
# note: add multiline fix

# Add completion to the current buffer
READLINE_LINE="${text}${completion}"
# Put the cursor at the end of the line
Expand Down
9 changes: 9 additions & 0 deletions scripts/powershell_plugin.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ Set-PSReadLineKeyHandler -Key Ctrl+g `

# get response from create_completion function
$output = create_completion($line)

# get first char of the response
# if its not #, add # to the beginning of the response
if ($output[0] -ne "#") {
$output = "# $output"
}
# note: add multiline fix



# check if output is not null
if ($output -ne $null) {
Expand Down
12 changes: 12 additions & 0 deletions scripts/zsh_plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ create_completion() {
# Get the text typed until now.
text=${BUFFER}
completion=$(echo -n "$text" | $CODEX_CLI_PATH/src/codex_query.py)


# add # to the beginning of $text if it doesnt start with #
# get the first non whitespace char
# first_char=$(echo $line | sed -e 's/^[[:space:]]*//')
# get the first char of the line
first_char=$(echo $text | cut -c 1)
if [ "$first_char" != "#" ]; then
text="# $text"
fi
# note: add multiline fix

# Add completion to the current buffer.
BUFFER="${text}${completion}"
# Put the cursor at the end of the line.
Expand Down