williamboman / nvim-lsp-installer

Further development has moved to https://github.com/williamboman/mason.nvim!
https://github.com/williamboman/mason.nvim
Apache License 2.0
2k stars 123 forks source link

Help: Support for Windows #40

Closed TeoDev1611 closed 3 years ago

TeoDev1611 commented 3 years ago

I use native lsp on Windows and Linux but I try some plugins which work only Linux and MacOS this plugin work in Windows or not ?🤔

williamboman commented 3 years ago

Hey @TeoDev1611! None of these installers have been tested on Windows, so YMMV. There are some installers that explicitly does not support Windows, for example rust_analyzer. LSP servers that only require you to install an npm package might work though! Have you tried it yet?

williamboman commented 3 years ago

Oh, PRs are also very welcomed should you want to add support for Windows!

TeoDev1611 commented 3 years ago

Hi I'm trying this now. This not work but in windows not exists /bin/bash this is the error ☚ī¸

TeoDev1611 commented 3 years ago

Oh, PRs are also very welcomed should you want to add support for Windows!

I check if I can make this, thanks for your awesome work

JonTofant commented 3 years ago

I get the same error on windows /bin/bash

williamboman commented 3 years ago

Yeah the current installers rely on Unix shell (all installers have their entrypoint in a bash shell). I imagine some would be really easy to get to work with Windows - the ones that leverage existing package management tools such as npm and pip.

I have barely any experience with Windows - is it common practice nowadays to run things in WSL? Or do people use Powershell?

JonTofant commented 3 years ago

I personaly use Powershell. I agree with you with npm and pip there shouldnt be much of a diffrence

TeoDev1611 commented 3 years ago

I use powershell or cmd or for run any command in cmd you can use:

cmd /c npm --version 

For example

barungh commented 3 years ago

Windows 10

In my Windows machine I am getting this error

[nvim-lsp-installer] Failed to install cssls.
"...r\\start\\nvim-lsp-installer\\lua\\nvim-lsp-installer\\fs.lua:8: Refusing to operate on path outside of the servers root dir
barungh commented 3 years ago

Hey @TeoDev1611! None of these installers have been tested on Windows, so YMMV. There are some installers that explicitly does not support Windows, for example rust_analyzer. LSP servers that only require you to install an npm package might work though! Have you tried it yet?

rust_analyzer works fine in Windows

Microsoft is consistently working to improve Powershell

I work on both Linux and Windows

Since the release neovim 0.5 ( Lua ) I am trying to set up everything on my Windows machine

with Coc-nvim everything was working fine in Powershell

but I am trying to configure everything with Lua

I tried many configuration like NvChad, LunarVim, VapourVim etc. but every config misses something

Especially I am finding difficulties to install language servers, but manually installing them works

with Vapour/Nvim almost all is set like flutter-tool and rust-tool, but my HTML, CSS servers are not configured properly

williamboman commented 3 years ago

I've started looking into this now. First goal is to enable support for LSP servers installed via npm, pip, or go. The more complex installers that require scripting will be secondary.

barungh commented 3 years ago

I've started looking into this now. First goal is to enable support for LSP servers installed via npm, pip, or go. The more complex installers that require scripting will be secondary.

I recently found this plugin ---> lspinstall.nvim which is of course a fork of this plugin 😄 , but , it's creator has configured it nicely to work with Windows

I am currently using it , for installing language servers in my windows 10 machine,

but there are still some issues

williamboman commented 3 years ago

Cool, thanks for sharing! I've also found https://github.com/mattn/vim-lsp-settings/tree/master/installer which has Windows support

williamboman commented 3 years ago

@barungh Just out of curiosity, what output do you get from the following?

PS > python --version
PS > python3 --version
barungh commented 3 years ago

Both same , in Powershell 7 prompt also in powershell 5 prompt

image

williamboman commented 3 years ago

Thanks! On Windows, do you know if it's safe to assume that if python3 is installed, python3 will be available in the path? I installed python3 via the installer, but I only ended up with python in the path.

barungh commented 3 years ago

I installed Python from Windows app store, and ~did not manually install python~ I mean, did not manually set path,

Screenshot 2021-08-27 194634

If Python is not installed in your Windows ( Windows 10 ) machine, invoking python from powershell prompt

ps>python 

will directly take you here Screenshot 2021-08-27 194010

Also searching for python in windows app store and chocolatey gives these results

Screenshot 2021-08-27 193914

Screenshot 2021-08-27 194246

In Edge browser ( Bing search result )

Screenshot 2021-08-27 194131

You can mention python3 as requirement also I found that few lsp servers like angularls does not install with latest npm when I downgraded from latest ( 16.xx ) to ( 14.xx ) of node then only I could successfully install servers for html, cssls and angular @williamboman

williamboman commented 3 years ago

Pushed to branch windows-support, feel free to give it a spin. Will look to merge in the next couple of days

barungh commented 3 years ago

Most of the servers are installing now, but I am yet to configure them with lspconfig

pyright, angularlsp installed

got error with few lsp

image

image

williamboman commented 3 years ago

Most of the servers are installing now, but I am yet to configure them with lspconfig

Sweet :+1:. If you just want to quickly try it out you can just run a one-off command like so:

:lua require("nvim-lsp-installer").on_server_ready(function(server) server:setup(); vim.cmd [[ do User LspAttachBuffers ]] end)

got error with few lsp

Yeah not all servers will be supported initially (those with custom install scripts, currently targeting *NIX shell). I'll put in a friendlier error message for Windows! I'm currently looking into whether using Node.js (via zx) as an intermediary runtime could make cross-platform support easier. So far I got rust_analyzer working, although a bit hacky.

williamboman commented 3 years ago

I've not been able to spend more time on this, so I went ahead and merged #70. A majority of LSPs now support Windows. There are a few remaining that require a custom install script which we'll have to deal with on a case by case basis. PRs much welomed!