-
Notifications
You must be signed in to change notification settings - Fork 15
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
PowerShell passes trimmed command to bash completion. #27
Comments
I am trying this with
Do you see the same broken behavior with |
@mikebattista ssh is working fine. The problem apparently appears when there is more than one option like in the example above |
Can you clarify what "importing completions from fish shell into bash" means? What steps did you take there? |
@mikebattista I have a script that looks into paths with fish completions and outputs a bash completion for each. function _code_bash_complete()
{
local word=${COMP_WORDS[COMP_CWORD]}
local completions
if [[ ${COMP_LINE} = 'code' ]]; then
completions=""
else
completions="$(fish -c "complete -C '${COMP_LINE}' | cut -f1 -d\\t" 2> /dev/null)"
fi
if [ $? -ne 0 ]; then
completions=""
fi
if [[ ${completions} =~ '~' ]]; then
completions="$(echo ${completions} | sed 's@~@\\~@g')"
word="$(echo ${word} | sed 's@~@\\~@g')"
fi
COMPREPLY=( $(compgen -W "$completions" -- "$word") )
};
complete -F _code_bash_complete code But i really don't think the problem is specific to this implementation. |
@archilkarchava I do see PowerShell truncating the $commandAst as you pointed out. I implemented your proposed fix. Could you confirm the latest changes in master address your scenario? |
@mikebattista yes, it works now! |
Awesome. I just published 0.2.4 with the fix. |
Describe the bug
PowerShell passes down command to be completed with trimmed spaces and some completions don't work because of that.
To Reproduce
Steps to reproduce the behavior:
pwsh
Expected behavior
PowerShell outputting completions for command that has spaces at the end.
Desktop (please complete the following information):
Additional context
The solution I found that works is to pad the
$COMP_LINE
until your cursor position$cursorPosition
.So instead of this:
do this:
The text was updated successfully, but these errors were encountered: