emacs-native-shell-complete
emacs-native-shell-complete copied to clipboard
Would be great to have PowerShell auto-completion support
What would be a good starting point to test out different characters for PowerShell auto-complete? Is (M-x shell) + activating PowerShell inside + using send-buffer commands good enough? Or should we start with PowerShell as default shell?
Any instructions for setting up a test environment with the purpose of understanding PowerShell auto-complete key sequences, would be great!
I am glad you are interested in trying this! The different completion styles are defined here (you will need to view it in Emacs to see the special characters.
https://github.com/CeleritasCelery/emacs-native-shell-complete/blob/01d8a2048e13f29dd3aa06281ac8cb466caddb64/native-complete.el#L56-L66
For each type of shell we define a set of character codes to send to the shell to get it to display the completion candidates. For example with zsh we send C-d
which prints all candidates, then send y
because it will sometimes ask for a confirmation, then send C-u
to clear the prompt to that point. This is different for the different shells.
What we need is the sequence for powershell. I usually start using the shell in a regular terminal (i.e. Windows Terminal or the powershell.exe). From there I can google or find in the docs what sequence is need to get it to print the completions for the current commandline. Like if I started with git st
I would expect it to complete git status
among others.
Once I have found the key sequence, I would do exactly what you describe. Try using powershell in M-x shell
and then use comint-simple-send
to see if it will print the completions in shell. From there it is pretty easy to add a new completion style.