microsoft / inshellisense

IDE style command line auto complete
MIT License
8.21k stars 179 forks source link

Autocomplete is not working in WSL2 bash #172

Closed st-man-hori closed 3 months ago

st-man-hori commented 4 months ago

Describe the bug Autocomplete is not working

To Reproduce Steps to reproduce the behavior:

  1. npm install -g @microsoft/inshellisense
  2. install complete
  3. is -s bash
  4. is -c
  5. inshellisense session [live]
  6. Even when typing commands like git, the autocomplete display does not appear.

Expected behavior "The GUI display for autocomplete appears

Environment

Additional context

cpendery commented 3 months ago

Verified as working in 0.0.1-rc.8

image

whiskeyo commented 3 months ago

@cpendery I'm running into the same problem with Debian WSL2 on Windows 11 even with 0.0.1-rc.8. Here is my setup:

03:24:49 whiskeyo@whiskeyo ~ → is --check
inshellisense session [live]
03:24:52 whiskeyo@whiskeyo ~ → is --version
0.0.1-rc.8
03:24:54 whiskeyo@whiskeyo ~ → cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
03:24:59 whiskeyo@whiskeyo ~ → node --version
v18.19.0
03:25:03 whiskeyo@whiskeyo ~ → bash --version
GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu)

Also, when I run the command inshellisense complete "ls -a", it shows e.g. this:

03:34:50 whiskeyo@whiskeyo ~ → inshellisense complete "ls -a"
{"suggestions":[{"name":"-A","description":"List all entries except for . and ...  Always set for the super-user","icon":"🔗","allNames":["-A"],"priority":50},{"name":"-a","description":"Include directory entries whose names begin with a dot (.)","icon":"🔗","allNames":["-a"],"priority":50}],"charactersToDrop":2}

so it looks like inshellisense is live, it just doesn't show any content for autocompletion. As one more thing to say, I am currently using oh-my-bash and with oh-my-bash disabled it seems to work just fine.

Could you recommend some actions that I could take in order to get it to work? :)

cpendery commented 3 months ago

@whiskeyo can I see what your prompt looks like? (feel free to strip any personal data) Also what are your PS1, PS2, and PROMPT_COMMAND environment variables set to?

whiskeyo commented 3 months ago

@cpendery sure, there's a screenshot with all values with both inshellisense enabled (on top) and disabled (on the bottom):

image

Also, here are these values if you needed to use them with inshellisense enabled:

And with inshellisense disabled:

If you need more details, I'll be there!

cpendery commented 3 months ago

Hm, it's definitely your PROMPT_COMMAND that's causing the issue. I've only setup shell integration for PS1 so far and your prompt isn't giving me any issues on its own. How did you setup/install oh-my-bash? I'll need to replicate that for testing the fix once it's ready

image

whiskeyo commented 3 months ago

Based on my bash history, I first installed inshellisense, then moved to download curl and git, and installed oh-my-bash with bash -c "$(...)" command from their README/tutorial:

image

Full command is here:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)"
whiskeyo commented 3 months ago

Also, to add some more data, here are my "most important" parts of .bashrc, some of these are automatically added by oh-my-bash during installation:

# Enable the subsequent settings only in interactive sessions
case $- in
  *i*) ;;
    *) return;;
esac

export OSH='/home/whiskeyo/.oh-my-bash'
OSH_THEME="font"
OMB_USE_SUDO=true

completions=(
  git
  composer
  ssh
)

aliases=(
  general
)

plugins=(
  git
  bashmarks
)

source "$OSH"/oh-my-bash.sh
. "$HOME/.cargo/env"
cpendery commented 3 months ago

@whiskeyo can you try if it works with the most recent change. The following command will install off main

npm uninstall @microsoft/inshellisense -g && git clone https://github.com/microsoft/inshellisense.git && cd inshellisense && npm install && npm run build && npm link
whiskeyo commented 3 months ago

@cpendery it seems to work with given command!!

image

I had to add sudo to the npm uninstall and npm link, but it worked.

cpendery commented 3 months ago

Closing this as fixed! I'll probably cut a new release Monday that includes this along with anything else I get done.