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

append ".cmd" to command arg0 if it fails on Windows #2130

Closed
justinmk opened this issue Sep 11, 2022 · 7 comments · Fixed by #2595
Closed

append ".cmd" to command arg0 if it fails on Windows #2130

justinmk opened this issue Sep 11, 2022 · 7 comments · Fixed by #2595
Labels
enhancement New feature or request

Comments

@justinmk
Copy link
Member

justinmk commented Sep 11, 2022

Problem

Commonly on Windows, some commands require the .cmd suffix. This is often missed, leading to issues like #2032 , and the solution is copy-pasted into configs: #2039

Proposal

@williamboman #2032 (comment) :

exepath() seems to solve this pretty nicely, as Neovim does respect PATHEXT. null-ls uses it and mason-lspconfig.nvim successfully patches cmds with it. I'd be happy to open a PR that patches commands with exepath() on Windows + normalizes all commands in server configs.

Or is there a reason why we don't use vim.fn.system() (which should do this automatically) instead of uv_spawn (vim.loop.spawn))? (Probably the reason is: that doesn't work in Lua "fast" callbacks)

@glepnir
Copy link
Member

glepnir commented Sep 11, 2022

I don't check the system c code but can we do it like system{fast=true} a little change ?

@justinmk
Copy link
Member Author

possibly.

@glepnir
Copy link
Member

glepnir commented Sep 11, 2022

Probably the reason is: that doesn't work in Lua "fast" callbacks

yup it not work in event loop unless we set {fast=true} .

@acfuns
Copy link

acfuns commented Oct 21, 2022

What is the current state?
On windows, mason download LSP is completely unavailable at all.

@kylo252

This comment was marked as off-topic.

@williamboman
Copy link
Contributor

What is the current state?
On windows, mason download LSP is completely unavailable at all.

I'd recommend using https://github.com/williamboman/mason-lspconfig.nvim if you're on Windows. It patches the commands for you automatically.

@GersiD
Copy link

GersiD commented Dec 21, 2022

This would be such a terrific addition! I just tore my hair out with this error! An lsp was erroring out because the language server command did not exist, I make sure to add it to the path, and still no dice. Once I added the .cmd to the end of the lsp start command it magically worked. Thank you so much for noticing! It makes me incredibly happy that I was not the only one with this issue.

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

Successfully merging a pull request may close this issue.

6 participants