microsoft / inshellisense

IDE style command line auto complete
MIT License
8.22k stars 180 forks source link

Also complete command name #111

Closed Edouard2laire closed 2 months ago

Edouard2laire commented 7 months ago

First, thanks a lot for having creating this great tool.

Is your feature request related to a problem? Please describe. When you start writing a command, 'ssh-a' for example, and press tab, the shell will suggest multiple command starting with ssh-a : 'ssh-add ssh-agent' or complete if only one command is available.

image

Describe the solution you'd like It would be nice to have the suggestion presented in the same fashion as the comand option with the possibility to complete the comand in a similar way as for the options. Probably we only want the suggestion to appear when using the tab key to avoid having to many suggestions.

Thanks :)

cpendery commented 6 months ago

@Edouard2laire this is an interesting idea, I'd have to see if it's possible to hook into every shell's suggestions to make this possible as I can't just parse a tab/double tab since it could vary based on user's setups. Which shell are you using?

Edouard2laire commented 6 months ago

Hello

I am using bash.

Zaidtech commented 6 months ago

Hi @cpendery , Can you help me to pick up this feature request. Would like to try to implement this feature.

cpendery commented 6 months ago

Hey @Zaidtech, happy for you to pick this up. I'd like the solution to hook directly into the shell's built-ins as part of the shellIntegration scripts (similar to how we output the cwd as a user navigates so we adjust the internal cwd.) rather than trying to parse the output directly. Take a look at compgen/complete for bash and this example of generating completions in powershell. We could set a keybinding on inshellisense's side where if the key pressed is tab twice, we send a custom signal (something like F12,y ) on the second tab to the shell that the shell integration script knows to respond with the completions in structured json / serialization form.

cpendery commented 2 months ago

This seems like it would be too much of a pain / not possible to hook into the tab completions of all 7 (cmd doesn't really count) supported shells. Closing this unless there is increase interest in the feature