fix(windows): auto-detect pwsh/powershell (Fixes #301)#302
fix(windows): auto-detect pwsh/powershell (Fixes #301)#302brianhuster merged 1 commit intobrianhuster:mainfrom sarahyack:fix-windows-pwsh
Conversation
|
Please take a look and let me know if there are any more issues! |
|
Heads Up (Unrelated to this Fix): While testing, I noticed that the plugin was failing to initialize a server for a HTML file I was trying to open. I had previously with the initial tests opened a Markdown file and not an HTML file, so I have no context in regards to whether it was broken then too, but as of right now the server is failing to start for HTML files. It will, however start for a Markdown file, though it only works the first time you open the server, after which even if you kill the port connection (whether using built-in Let me know if you would like me to file bug reports related to the issues outlined above, and I'd be happy to oblige! Please note, however, the scope of these issues falls outside of my experience, and I would be unlikely to be able to resolve them. |
|
Yes, you can open a bug report with reproduce steps |
|
Does anything require change for this PR? |
|
Can you please rebase it? |
Never used |
|
No, I mean you should make your PR contains only 1 commit |
Why not squash & merge? I'm not sure how I could do that. I could simply erase the history, I suppose and rebase to the beginning, but wouldn't a squash make more sense? |
|
Yes, I mean squash |
That's as good as I can get. I tried to rebase it to the first commit hash in the |
|
Use command |
Thank you, how's that? |
|
LGTM |
Issue
The default shell command selection for windows was simply
"pwsh", as this is only applicable for Powershell Core (6/7) shipped with Windows 11, it is not applicable for Windows 10, as it usually ships with Powershell 5.1, which does not have thepwshcommand built-in, and instead launches with the commandpowershell.Fixes #301
Fix
Changed the windows shell selection part of
utils.term_cmd&utils.await_term_cmdto use a new picker functionpick_powershell(), that determines which command vim detects is available withvim.fn.executable(), with a preference towards the newerpwsh, and a fallback topowershell.Testing
I do not have a Windows 11 machine or VM, so only tested on a Windows 10 machine, but the error mentioned in #301 no longer occurs with the new changes, and
:LivePreview startworks as expected. No changes to previous functionality for windows users should occur besides adding support for Windows 10, thus I expect everything should work fine on a Windows 11 machine.Happy to tweak based on feedback!