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

Would be great to have PowerShell auto-completion support #19

Open
mateialexandru opened this issue Jun 17, 2022 · 1 comment
Open

Would be great to have PowerShell auto-completion support #19

mateialexandru opened this issue Jun 17, 2022 · 1 comment

Comments

@mateialexandru
Copy link

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!

@CeleritasCelery
Copy link
Owner

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.

(defcustom native-complete-style-suffix-alist
'((bash . "\e*'� echo '�")
(zsh . "�y�")
(csh . "�y�")
(sqlite . "\t\ty�")
(default . "\ty�"))
"Alist mapping style symbols to strings appended to completion candidates.
The keys should be the same as the possible values of
`native-complete-style-regex-alist'."
:type '(alist :key-type symbol :value-type string)
:options '(bash zsh csh sqlite default))

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants