Giter Site home page Giter Site logo

williamboman / nvim-lsp-installer Goto Github PK

View Code? Open in Web Editor NEW
2.0K 7.0 123.0 1.47 MB

Further development has moved to https://github.com/williamboman/mason.nvim!

Home Page: https://github.com/williamboman/mason.nvim

License: Apache License 2.0

Lua 99.53% Shell 0.04% Makefile 0.07% Vim Script 0.36%

nvim-lsp-installer's Introduction

ℹ️ Project status

This is an excerpt from the announcement here.

nvim-lsp-installer is no longer maintained.

mason.nvim is the next generation version of nvim-lsp-installer. It builds on top of the very same foundation as nvim-lsp-installer (which means it's easy to migrate), but with a majority of internals refactored to improve extensibility and testability.

More importantly, the scope of mason.nvim has also been widened to target more than just LSP servers. mason.nvim supports DAP servers, linters, formatters, and more. As of writing, mason.nvim provides 150+ packages for 100+ languages. It can be thought of as a general-purpose package manager, native to Neovim, that runs everywhere Neovim runs (Windows, macOS, Linux, etc.).

Another big change with mason.nvim is that executables are now linked to a single, shared, location, allowing seamless access from Neovim builtins (shell, terminal, etc.) as well as other 3rd party plugins.

There have also been other improvements such as broader test coverage, more documentation, and a revamped UI - check it out!

nvim-lsp-installer

About

Neovim plugin that allow you to manage LSP servers (servers are installed inside :echo stdpath("data") by default). It works in tandem with lspconfig1 by registering a hook that enhances the PATH environment variable, allowing neovim's LSP client to locate the server executable installed by nvim-lsp-installer.2

On top of just providing commands for installing & uninstalling LSP servers, it:

  • provides a graphical UI
  • provides the ability to check for, and upgrade to, new server versions through a single interface
  • supports installing custom versions of LSP servers (for example :LspInstall rust_analyzer@nightly)
  • relaxes the minimum requirements by attempting multiple different utilities (for example, only one of wget, curl, or Invoke-WebRequest is required for HTTP requests)
  • hosts a suite of system tests for all supported servers
  • has full support for Windows

1 - while lspconfig is the main target, this plugin may also be used for other use cases
2 - some servers don't provide an executable, in which case the full command to spawn the server is provided instead

Screenshots

Requirements

Requires neovim >= 0.7.0 and nvim-lspconfig.

Minimum requirements

The minimum recommended requirements are:

  • For Unix systems: git(1), curl(1) or wget(1), unzip(1), tar(1), gzip(1)
  • For Windows systems: powershell, git, tar, and 7zip or peazip or archiver or winzip or WinRAR

Additional requirements

Additional requirements to install & run all servers are (depending on usage):

  • Node.js (LTS) & npm
  • Python3 & pip3
  • go >= 1.17
  • cargo
  • Ruby & gem
  • PHP & Composer
  • JDK
  • Julia
  • dotnet
  • ghcup
  • luarocks
  • meson
  • ninja
  • pwsh
  • rebar3
  • valac

Installation

use {
    "williamboman/nvim-lsp-installer",
    "neovim/nvim-lspconfig",
}

vim-plug

Plug 'williamboman/nvim-lsp-installer'
Plug 'neovim/nvim-lspconfig'

Usage

nvim-lsp-installer will only make sure that Neovim can find your installed servers, it does not set up any servers for you automatically. You will have to set up your servers yourself (for example via lspconfig).

Setup

In order for nvim-lsp-installer to register the necessary hooks at the right moment, make sure you call the require("nvim-lsp-installer").setup() function before you set up any servers!

require("nvim-lsp-installer").setup {}

Refer to the Configuration section for information about which settings are available.

Commands

  • :LspInstallInfo - opens a graphical overview of your language servers
  • :LspInstall [--sync] [server] ... - installs/reinstalls language servers. Runs in a blocking fashion if the --sync argument is passed (only recommended for scripting purposes).
  • :LspUninstall [--sync] <server> ... - uninstalls language servers. Runs in a blocking fashion if the --sync argument is passed (only recommended for scripting purposes).
  • :LspUninstallAll [--no-confirm] - uninstalls all language servers
  • :LspInstallLog - opens the log file in a new tab window
  • :LspPrintInstalled - prints all installed language servers

Configuration

You may optionally configure certain behavior of nvim-lsp-installer when calling the .setup() function.

Refer to the default configuration for all available settings.

Example:

require("nvim-lsp-installer").setup({
    automatic_installation = true, -- automatically detect which servers to install (based on which servers are set up via lspconfig)
    ui = {
        icons = {
            server_installed = "",
            server_pending = "",
            server_uninstalled = ""
        }
    }
})

Available LSPs

Language Server name
AWK awk_ls
Angular angularls
Ansible ansiblels
Apex apex_ls
Arduino (docs!!!) arduino_language_server
Assembly (GAS/NASM, GO) asm_lsp
Astro astro
Bash bashls
Beancount beancount
Bicep bicep
C ccls
C clangd
C# csharp_ls
C# (docs) omnisharp
C++ ccls
C++ clangd
CMake cmake
CSS cssls
CSS cssmodules_ls
Clarity clarity_lsp
Clojure clojure_lsp
CodeQL codeqlls
Crystal crystalline
Crystal scry
Cucumber cucumber_language_server
Dart dartls
Deno denols
Dhall dhall_lsp_server
Diagnostic (general purpose server) diagnosticls
Dlang serve_d
Docker dockerls
Dot dotls
EFM (general purpose server) efm
ESLint (docs) eslint
Elixir elixirls
Elm elmls
Ember ember
Emmet emmet_ls
Erlang erlangls
F# fsautocomplete
Flux flux_lsp
Foam (OpenFOAM) foam_ls
Fortran fortls
Go golangci_lint_ls
Go gopls
Grammarly grammarly
GraphQL graphql
Groovy groovyls
HTML html
Haskell hls
Haxe haxe_language_server
Hoon hoon_ls
JSON jsonls
Java (docs) jdtls
JavaScript quick_lint_js
JavaScript tsserver
Jsonnet jsonnet_ls
Julia (docs) julials
Kotlin kotlin_language_server
LaTeX ltex
LaTeX texlab
Lelwel lelwel_ls
Lua sumneko_lua
Markdown marksman
Markdown prosemd_lsp
Markdown remark_ls
Markdown zk
Metamath Zero mm0_ls
Nickel nickel_ls
Nim nimls
Nix rnix
OCaml ocamlls
OCaml ocamllsp
Objective C ccls
OneScript, 1C:Enterprise bsl_ls
OpenCL opencl_ls
PHP intelephense
PHP phpactor
PHP psalm
Perl perlnavigator
Powershell powershell_es
Prisma prismals
Puppet puppet
PureScript purescriptls
Python jedi_language_server
Python pyright
Python sourcery
Python (docs) pylsp
R r_language_server
ReScript rescriptls
Reason reason_ls
Robot Framework robotframework_ls
Rome rome
Ruby solargraph
Rust rust_analyzer
SQL sqlls
SQL sqls
Salt salt_ls
Shopify Theme Check theme_check
Slint slint_lsp
Solidity solang
Solidity solc
Solidity (VSCode) solidity_ls
Sorbet sorbet
Sphinx esbonio
Stylelint stylelint_lsp
Svelte svelte
Swift sourcekit
SystemVerilog svlangserver
SystemVerilog svls
SystemVerilog verible
TOML taplo
Tailwind CSS tailwindcss
Teal teal_ls
Terraform terraformls
Terraform (docs) tflint
TypeScript tsserver
V vls
Vala vala_ls
VimL vimls
Visualforce visualforce
Vue volar
Vue vuels
XML lemminx
YAML yamlls
Zig zls

Logo

Illustrations in the logo are derived from @Kaligule's "Robots" collection.

Default configuration

local DEFAULT_SETTINGS = {
    -- A list of servers to automatically install if they're not already installed. Example: { "rust_analyzer", "sumneko_lua" }
    -- This setting has no relation with the `automatic_installation` setting.
    ensure_installed = {},

    -- Whether servers that are set up (via lspconfig) should be automatically installed if they're not already installed.
    -- This setting has no relation with the `ensure_installed` setting.
    -- Can either be:
    --   - false: Servers are not automatically installed.
    --   - true: All servers set up via lspconfig are automatically installed.
    --   - { exclude: string[] }: All servers set up via lspconfig, except the ones provided in the list, are automatically installed.
    --       Example: automatic_installation = { exclude = { "rust_analyzer", "solargraph" } }
    automatic_installation = false,

    ui = {
        -- Whether to automatically check for outdated servers when opening the UI window.
        check_outdated_servers_on_open = true,

        -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
        border = "none",

        icons = {
            -- The list icon to use for installed servers.
            server_installed = "",
            -- The list icon to use for servers that are pending installation.
            server_pending = "",
            -- The list icon to use for servers that are not installed.
            server_uninstalled = "",
        },
        keymaps = {
            -- Keymap to expand a server in the UI
            toggle_server_expand = "<CR>",
            -- Keymap to install the server under the current cursor position
            install_server = "i",
            -- Keymap to reinstall/update the server under the current cursor position
            update_server = "u",
            -- Keymap to check for new version for the server under the current cursor position
            check_server_version = "c",
            -- Keymap to update all installed servers
            update_all_servers = "U",
            -- Keymap to check which installed servers are outdated
            check_outdated_servers = "C",
            -- Keymap to uninstall a server
            uninstall_server = "X",
        },
    },

    -- The directory in which to install all servers.
    install_root_dir = path.concat { vim.fn.stdpath "data", "lsp_servers" },

    pip = {
        -- These args will be added to `pip install` calls. Note that setting extra args might impact intended behavior
        -- and is not recommended.
        --
        -- Example: { "--proxy", "https://proxyserver" }
        install_args = {},
    },

    -- Controls to which degree logs are written to the log file. It's useful to set this to vim.log.levels.DEBUG when
    -- debugging issues with server installations.
    log_level = vim.log.levels.INFO,

    -- Limit for the maximum amount of servers to be installed at the same time. Once this limit is reached, any further
    -- servers that are requested to be installed will be put in a queue.
    max_concurrent_installers = 4,

    github = {
        -- The template URL to use when downloading assets from GitHub.
        -- The placeholders are the following (in order):
        -- 1. The repository (e.g. "rust-lang/rust-analyzer")
        -- 2. The release version (e.g. "v0.3.0")
        -- 3. The asset name (e.g. "rust-analyzer-v0.3.0-x86_64-unknown-linux-gnu.tar.gz")
        download_url_template = "https://github.com/%s/releases/download/%s/%s",
    },
}

nvim-lsp-installer's People

Contributors

aidos avatar alex-popov-tech avatar anishde12020 avatar ankurs47 avatar borwe avatar cathaysia avatar christianchiarulli avatar connorlay avatar davidepi avatar decodetalkers avatar eliozh avatar evantancy avatar fsmiamoto avatar github-actions[bot] avatar hermitmaster avatar iabdelkareem avatar indianboy42 avatar itsjef avatar jschrtke avatar kylo252 avatar lctrs avatar mystilleef avatar rentziass avatar sethidden avatar skwee357 avatar thetic avatar williamboman avatar williambotman avatar xdoardo avatar zalegrala avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

nvim-lsp-installer's Issues

Is it possible to change the path it installs to?

I am trying to migrate from nvim-lspinstall, I don't really want to switch all my setup calls to the new path. AFAICT I should use on_server_ready to do the setup, but I actually only call .setup() for a LSP server in an ftplugin file for the corresponding LSPs file type. To transition this to using on_server_ready would also be a fairly significant change to my config.

So the path of least resistance is telling this plugin to install to a different path

Autofix for supported servers

Thanks for this neat plugin!

Now that we have eslintls and it is using vscode-eslint, can we have the feature provided by source.fixAll.eslintin vscode-eslint so that listing issues are resolved on save? Personally I don't like coc.nvim approach of providing a json config file similar to vscode's config file. I would prefer a flag in lua setup function of this plugin so that we are sticking with neovim environment patterns for configuration rather than bringing vscode style configuration to neovim.

lsp_installer_allow_federated_servers default behavior breaks jsonls, cssls, and html

Given the following configuration, jsonls, cssls, and html are all created in $HOME/.local/share/nvim/lsp_servers/ in three separate directories: vscode-langservers-extracted_jsonls, vscode-langservers-extracted_cssls, vscode-langservers-extracted_html. However, their LSP configs all are looking for only vscode-langservers-extracted for their cmd. Adding vim.g.lsp_installer_allow_federated_servers = 1 before this code fixes the issue. Setting the global to 0 does not fix the behavior as the cmd for those language servers continue to use only vscode-langservers-extracted.

local desired_servers = {
  sumneko_lua = {
    settings = {
      Lua = {
        diagnostics = {
          globals = { 'vim' }
        },
        telemetry = {
          enable = false
        }
      }
    }
  },
  jsonls = {},
  cssls = {},
  html = {},
  bashls = {},
  yamlls = {},
  pyright = {},
  terraformls = {}
}

local lsp_installer = require'nvim-lsp-installer'

for server_name, _ in pairs(desired_servers) do
  local ok, server = lsp_installer.get_server(server_name)
  if ok then
    if not server:is_installed() then
      server:install()
    end
  end
end

lsp_installer.on_server_ready(function(server)
  local opts = desired_servers[server.name]

  server:setup(opts)
  vim.cmd [[ do User LspAttachbuffers ]]
end)

ARM Support

Currently I notice there is no ARM support - so running on a raspberry pi or even
in Termux (Android) would no work.

I realize that some / most of the servers are being downloaded from the corresponding release page and therefore the pc architecture is none exitances...

EFM server won't install

It's the only one that won't work.

It simply creates empty directory for efm.

Arch Linux
Neovim 0.5.1

Debug log:

     49 [DEBUG Mon 04 Oct 2021 02:30:48 PM BST] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:348: Installing server {¬                                                                                                                                                                                                                                                                                                     
     48 │ _default_options = {¬                                                                                                                                                                                                                                                                                                                                                                                                           
     47 │ │ cmd = { "/home/kuba/.local/share/nvim/lsp_servers/efm/efm-langserver" }¬                                                                                                                                                                                                                                                                                                                                                      
     46 │ },¬                                                                                                                                                                                                                                                                                                                                                                                                                             
     45 │ _installer = <function 1>,¬                                                                                                                                                                                                                                                                                                                                                                                                     
     44 │ _root_dir = "/home/kuba/.local/share/nvim/lsp_servers/efm",¬                                                                                                                                                                                                                                                                                                                                                                    
     43 │ name = "efm",¬                                                                                                                                                                                                                                                                                                                                                                                                                  
     42 │ root_dir = "/home/kuba/.local/share/nvim/lsp_servers/efm",¬                                                                                                                                                                                                                                                                                                                                                                     
     41 │ <metatable> = <1>{¬                                                                                                                                                                                                                                                                                                                                                                                                             
     40 │ │ __index = <table 1>,¬                                                                                                                                                                                                                                                                                                                                                                                                         
     39 │ │ create_root_dir = <function 2>,¬                                                                                                                                                                                                                                                                                                                                                                                              
     38 │ │ get_default_options = <function 3>,¬                                                                                                                                                                                                                                                                                                                                                                                          
     37 │ │ install = <function 4>,¬                                                                                                                                                                                                                                                                                                                                                                                                      
     36 │ │ install_attached = <function 5>,¬                                                                                                                                                                                                                                                                                                                                                                                             
     35 │ │ is_installed = <function 6>,¬                                                                                                                                                                                                                                                                                                                                                                                                 
     34 │ │ new = <function 7>,¬                                                                                                                                                                                                                                                                                                                                                                                                          
     33 │ │ setup = <function 8>,¬                                                                                                                                                                                                                                                                                                                                                                                                        
     32 │ │ uninstall = <function 9>¬                                                                                                                                                                                                                                                                                                                                                                                                     
     31 │ }¬                                                                                                                                                                                                                                                                                                                                                                                                                              
     30 } nil¬                                                                                                                                                                                                                                                                                                                                                                                                                            
     29 [DEBUG Mon 04 Oct 2021 02:30:48 PM BST] ...nvim-lsp-installer/lua/nvim-lsp-installer/ui/display.lua:208: Buffer or window is no longer valid 1002 3¬                                                                                                                                                                                                                                                                              
     28 [INFO  Mon 04 Oct 2021 02:30:48 PM BST] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:286: Starting install server_name="efm", requested_version="N/A"¬                                                                                                                                                                                                                                                             
     27 [DEBUG Mon 04 Oct 2021 02:30:48 PM BST] ...nvim-lsp-installer/lua/nvim-lsp-installer/ui/display.lua:261: Opening window¬                                                                                                                                                                                                                                                                                                          
     26 [DEBUG Mon 04 Oct 2021 02:30:48 PM BST] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:51: Spawning go {¬                                                                                                                                                                                                                                                                                                            
     25 │ args = { "get", "-v", "github.com/mattn/efm-langserver" },¬                                                                                                                                                                                                                                                                                                                                                                     
     24 │ cwd = "/home/kuba/.local/share/nvim/lsp_servers/efm",¬                                                                                                                                                                                                                                                                                                                                                                          
     23 │ env = { "FZF_CTRL_T_COMMAND=fd --type file --hidden --exclude .git --color always --follow", "HOMEBREW_PREFIX=/home/linuxbrew/.linuxbrew", "VISUAL=nvim", "_ZPLUG_CONFIG_SUBSHELL=:", "XDG_SESSION_CLASS=user", "_ZPLUG_PREZTO=sorin-ionescu/prezto", "INFOPATH=/home/linuxbrew/.linuxbrew/share/info:", "KITTY_LISTEN_ON=/tmp/mykitty", "LS>
     22 │ stdio_sink = {¬                                                                                                                                                                                                                                                                                                                                                                                                                 
     21 │ │ stderr = <function 1>,¬                                                                                                                                                                                                                                                                                                                                                                                                       
     20 │ │ stdout = <function 2>,¬                                                                                                                                                                                                                                                                                                                                                                                                       
     19 │ │ <metatable> = {¬                                                                                                                                                                                                                                                                                                                                                                                                              
     18 │ │ │ __tostring = <function 3>¬                                                                                                                                                                                                                                                                                                                                                                                                  
     17 │ │ }¬                                                                                                                                                                                                                                                                                                                                                                                                                            
     16 │ }¬                                                                                                                                                                                                                                                                                                                                                                                                                              
     15 }¬                                                                                                                                                                                                                                                                                                                                                                                                                                
     14 [DEBUG Mon 04 Oct 2021 02:30:48 PM BST] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:91: Spawned with pid 88791¬                                                                                                                                                                                                                                                                                                   
     13 [DEBUG Mon 04 Oct 2021 02:30:49 PM BST] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:51: Spawning go {¬                                                                                                                                                                                                                                                                                                            
     12 │ args = { "clean", "-modcache" },¬                                                                                                                                                                                                                                                                                                                                                                                               
     11 │ cwd = "/home/kuba/.local/share/nvim/lsp_servers/efm",¬                                                                                                                                                                                                                                                                                                                                                                          
     10 │ env = {"FZF_CTRL_T_COMMAND=fd --type file --hidden --exclude .git --color always --follow", "HOMEBREW_PREFIX=/home/linuxbrew/.linuxbrew", "VISUAL=nvim", "_ZPLUG_CONFIG_SUBSHELL=:", "XDG_SESSION_CLASS=user", "_ZPLUG_PREZTO=sorin-ionescu/prezto", "INFOPATH=/home/linuxbrew/.linuxbrew/share/info:", "KITTY_LISTEN_ON=/tmp/mykitty", "LS>
      9 │ stdio_sink = {¬                                                                                                                                                                                                                                                                                                                                                                                                                 
      8 │ │ stderr = <function 1>,¬                                                                                                                                                                                                                                                                                                                                                                                                       
      7 │ │ stdout = <function 2>,¬                                                                                                                                                                                                                                                                                                                                                                                                       
      6 │ │ <metatable> = {¬                                                                                                                                                                                                                                                                                                                                                                                                              
      5 │ │ │ __tostring = <function 3>¬                                                                                                                                                                                                                                                                                                                                                                                                  
      4 │ │ }¬                                                                                                                                                                                                                                                                                                                                                                                                                            
      3 │ }¬                                                                                                                                                                                                                                                                                                                                                                                                                              
      2 }¬                                                                                                                                                                                                                                                                                                                                                                                                                                
      1 [DEBUG Mon 04 Oct 2021 02:30:49 PM BST] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:91: Spawned with pid 88867¬                                                                                                                                                                                                                                                                                                   
      0 [INFO  Mon 04 Oct 2021 02:30:49 PM BST] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:305: Installation completed server_name="efm", success=true¬                                                                                                                                                                                                                                                                  

Feature request: Rule name on ESLint errors/warnings

Here for example the rule name is react-hooks/exhaustive-deps but it does not appear in warning.

Neovim + LSP Saga + Nvim LSP Installer:

image

It does appears when using VSCode's ESLint plugin or with Sublime Text's LSP ESLint plugin however.

VSCode + ESLint:

image

Sublime Text + LSP ESLint:

image

Wrong cmd path for hls (Haskell)

Current:
cmd = { path.concat { root_dir, "haskell-language-server-wrapper", "--lsp" } },

Correct:
cmd = { path.concat { root_dir, "haskell-language-server-wrapper" }, "--lsp" },

Issue in ESLint auto-fix when it adds disable rule comment on same line

I'm not sure if this is the correct repo to file this issue but for few auto-fixes where ESLint needs to remove a line and insert another, it doesn't removes the line. Also notice a newline after comment isn't added either:

When a code action to disable ESLint rule using comment is applied on the same line, it appends original content of the line after the comment.

tre (0)

cdcds 398

I can confirm that this correctly works in VS Code.

To reproduce:

  • Open this CodeSandbox and download it using File -> Export to ZIP
  • Extract the zip and install packages using npm i or any Node.js package manager
  • Open App.js and navigate to line 9 to see a warning and code action

Sometimes the :LspInfo shows "0 client(s) attached to this buffer"

Could you provide some info for newbies on how to make these LSPs start automatically?

In my case sometimes it will be triggered(when I first open a file by nvim), while sometimes it doesn't(I used nvim-tree to open many buffers and then switch to a certain one).

Screenshot:

image

GraphQL language server in react

This is more of just a question but have you actually managed to use the graphql lsp in a typescript react project? I don't seem to get autocomplete

EFM for windows

Ehy, great plugin, been in love so far.

When I work in linux, everything is perfect, however sometimes I have to work on the little VM windows machine, and in there, I cannot install EFM

Failed to spawn process cmd=go pid=ENOENT: no such file or directory

clangd.bat not working well

Hello,
When I go through clangd.bat, I get the error below, while I have a local clangd.exe that works fine. Why don't I go directly to a clangd.exe?
image
image

Feedback and additional configuration in the readme

@williamboman - Just wanted to say big props for nvim-lsp-installer. I installed it tonight and it's lightning fast. Much faster than nvim-lspinstall and far more accessible from a UI perspective. So thank you 👏🏼 .

I've just pushed my config to my dotfiles in this commit. One thing that struck me was that whilst I found this easy to setup exactly as I wanted, this was primarily down to many hours spent messing around with LSP configurations and pouring over other peoples dotfiles.

I'd be more than happy to contribute to a Wiki or a USAGE.md file for more advanced setups.

Always install latest Haskell LSP

The latest version of hls is 1.3.0. This installer downloads 1.2.0.

I'm not sure hard-coding the language server versions is a good idea, especially for Haskell projects.

If resolvers, compilers, and language server versions don't match in some Haskell projects, especially those that use Stack, then the language server will not work.

It'd be nice if LspInstall hls installs the latest language server. I assume most user will be updating their language server after updating their project resolver.

Add some metadata to the servers

It's pretty useful to be able to query the package_name when it's applicable. This will allow for some flexibility and easy to implement features, here are some of them:

  • very useful for debugging, since some servers may have multiple distributions, see: https://github.com/hrsh7th/vscode-langservers-extracted
  • ability to reuse a server that already exists on path
  • allow installing/updating globally, but still without requiring sudo, i,e: pip install --user and so on
  • you can uninstall a package by name instead of nuking the folder
  • use the package full name in the info panel instead of the abbreviated name used by lspconfig. (since you actually need npm install bash-language-server for bashls)
  • allow an easier way to fetch metadata for some fancy LspInstallInfo per server

Let me know what you think :)

LSP's using zx to install fails on `replaceAll('\\', '\\\\')

Software installed

  • Ubuntu-20.04 LTS
  • Neovim 0.5 (nightly, or app image)
  • Latest nvim-lsp-installer plugin

Description

Firstly, thanks for writing this installer. It has simplified my neovim setup immensely!

The issue occurs when I try to install lsps that rely on the zx package. Specifically terraform-ls and clangd. When running :LspInstall, I get the following error:

file:///home/issafalcon/.local/share/nvim/lsp_servers/.zx/node_modules/zx/index.mjs:244
      .replaceAll('\\', '\\\\')
       ^

TypeError: arg.replaceAll is not a function
    at Function.quote (file:///home/issafalcon/.local/share/nvim/lsp_servers/.zx/node_modules/zx/index.mjs:244:8)
    at $ (file:///home/issafalcon/.local/share/nvim/lsp_servers/.zx/node_modules/zx/index.mjs:39:13)
    at file:///home/issafalcon/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer/lua/nvim-lsp-installer/servers/clangd/install.mjs:15:8
    at ModuleJob.run (internal/modules/esm/module_job.js:170:25)
    at async Loader.import (internal/modules/esm/loader.js:178:24)
    at async importPath (file:///home/issafalcon/.local/share/nvim/lsp_servers/.zx/node_modules/zx/zx.mjs:130:3)
    at async file:///home/issafalcon/.local/share/nvim/lsp_servers/.zx/node_modules/zx/zx.mjs:49:5

[Process exited 1]

I tried for clojure_lsp also, which has the same issue, but sumneko_lua works fine. For now, I am installing manually and using my own configuration for these servers, but thought I would raise this in case others are finding the same problem, and it's not just an issue on my own machine setup.

Lazy Loading support

Hi 😃 I'm here again

image

I just found this with the plugi takes sooome of time any idea how improve the lazy loading?

[Feature Request] Expose `default_options` as part of API

I'm wanting to use this package to install rust-analyzer automatically but I actually want to use rust-tools.nvim to run the lsp stuff.

What I'd like to do is roughtly this:

local lsp_installer = require('nvim-lsp-installer')
local server = lsp_installer.get_server('rust_analyzer')

if not server.is_installed() then
    server.install()
end

require('rust-tools').setup({
    -- other opts
    server = server.default_options,
})

Currently I think I can just use server._default_options, but it would be nice if this was a documented field that was properly exposed.

minimal sample stopped working

hello!
here is video of minimal setup of that perfect plugin, which stopped working ( i think after updating it today ):

screencast.2021-09-08.18-30-50.mp4

basically it looks like cb is never called for some reason 🤔
any ideas on that?

install hls failed

It seems to have succeeded until the download.

...
      2021-09-30 17:20:01 (72.0 MB/s) - ‘archive.tar.gz’ saved [346375300/346375300]
      
      
      haskell-language-server-8.10.2
      
      haskell-language-server-8.10.3
      
      haskell-language-server-8.10.4
      
      haskell-language-server-8.10.5
      
      haskell-language-server-8.10.6
      
      haskell-language-server-8.10.7
      
      haskell-language-server-8.6.4
      
      haskell-language-server-8.6.5
      
      haskell-language-server-8.8.3
      
      haskell-language-server-8.8.4
      
      haskell-language-server-9.0.1
      
      haskell-language-server-wrapper
      
      sh: 1: set: Illegal option -o pipefail

Unable to delete/reinstall efm-langserver

Steps to reproduce:

  1. call LspInstall efm
  2. call it again

Expected result - efm should be reinstalled without errors
Actual result - error is shown

Error detected while processing function <SNR>52_LspInstall:
line    1:
[nvim-lsp-installer] Failed to install efm.
'...r/start/nvim-lsp-installer/lua/nvim-lsp-installer/fs.lua:15: rmrf: Could not remove directory "/User
s/alexanderpopov/.local/share/nvim/lsp_servers/efm".'

Note: same thing happens on LspUninstall efm

Failed to spawn process cmd=/bin/bash pid=ENOENT: no such file or directory

OS: NixOS

The bash binary is not present at /bin/bash on systems like NixOS and some BSDs.
However, /bin/sh is present for all POSIX compliant systems. On standard linux systems, /bin/sh is symlinked to either bash or dash or some equivalent. I think, nvim-lsp-installer, should use /bin/sh instead of /bin/bash.

Extra servers are being installed

Hello, thank you for the plugin!

Issue is having following code:

local servers = {"tsserver", "jsonls", "sumneko_lua", "terraformls" }

_G.installLspServers = function()
    cmd('LspUninstallAll')
    for _, name in pairs(servers) do
      print("installing " .. name)
      cmd('LspInstall ' .. name)
    end
end

after executing i have following installed servers:

['cssls', 'html', 'tsserver', 'jsonls', 'sumneko_lua', 'terraformls']

so cssls and html were installed by they own, and it causes issues in my config, since i expect only mentioned servers to be present

proxy support for pip

hello,

sorry for the inconvenience, but python pip asks for the "--proxy=" argument when you are behind a proxy (and I can't find a global configuration for pip). Is it possible to add a proxy option for pip.

Windows LspInstall clangd not working

When i try to install clangd server with LspInstall clangd it doesn't finish installing never and after restart neovim it lsp says that the exe is not executable.

After LspInstall clangd command:
Pending servers (1)
◍ clangd (running) PS D:\Code\Configurations\nvim\nvim-data\lsp_servers\clangd>

Never change ^

Config: clangd
filetypes: c, cpp, objc, objcpp
root directory: D:\Code
cmd: D:\Code\Configurations\nvim\nvim-data\lsp_servers\clangd\clangd
cmd is executable: Unable to find executable. Please check your path and ensure the server is installed
autostart: true
custom handlers:

Clangd is not completting

Hi i´m here again. 😀

Well I do this issue because as I could already install clangd, now that I wanted to make a .c file it does not give me the autocompletion option, but, when I write and repeat again, the "option" appears.
autocomplete but with buffer, if I do it in a .vim or .lua file if I get the autocomplete option.

Could you help me to know what the problem is? 🤔😅

Here are some evidences:
.vim file
image

.c file
In this part I want to write int, but I don´t see that the autocomplete is working in .c files
image

Clangd in Windows

Hi! 😀

I make this issue because I wanted to know if Clangd is available on Windows, because I run :LspInstall clangd,
and it tells me: Windows is not supported yet for server "clangd".

And what I want to ask is if you could give support to clangd in Windows or do I have to install something so that the server can be installed.

That's all I await your answer. 😊

Client 2 quit with exit code 0 (jdtls)

Hello, just wanted to try jdtls language server,
but got this error, and in lsp.log : [ERROR][2021-10-09 22:57:48] .../vim/lsp/rpc.lua:431 "rpc" "java" "stderr" "Error: Unable to access jarfile /home/[myusername]/.local/share/nvim/lsp_servers/jdtls/plugins/org.eclipse.equinox.launcher_*.jar\n"

Thanks in advance.
(other languages servers work perfectly (omnisharp, etc.))

Can't remove eslintls

It looks like eslintls is installed by default. LspUninstall eslintls doesn't remove it. I already use eslint with null-ls. So I don't need it installed at all.

Missing dependency for tsserver

Hi
thx for your great work on this project

but there is a problem I notice when working with js/ts projects using tsserver that sometimes popup in any babel project
Screenshot from 2021-08-26 11-24-19

so after installing typescript everything goes fine and missing binary are generated also:
Screenshot from 2021-08-26 11-25-36

I think the installer command must be npm i typescript typescript-language-server.

Error on initialising

I'm having the following error when I call is_installed

E5113: Error while calling lua chunk: ...art/nvim-lsp-installer/lua/nvim-lsp-installer/server.lua:70: attempt to index local 'self' (a nil value)

Here's my config:

function ensure_server(name)
    local lsp_installer = require'nvim-lsp-installer.servers'
    local _, server = lsp_installer.get_server(name)
    if not server.is_installed() then
        server.install()
    end
    return server
end

ensure_server('pyright')
ensure_server('tsserver')
local rust_server = ensure_server('rust_analyzer')
require('rust-tools').setup({
    tools = {
        autoSetHints = true,
        hover_with_actions = true,
        inlay_hints = {
            show_parameter_hints = true,
            parameter_hints_prefix = '',
            other_hints_prefix = '',
        },
    },
    server = {
        on_attach = lsp_status.on_attach,
        capabilities = lsp_status.capabilities,
        cmd = rust_server.get_default_options().cmd,
        settings = {
            ['rust-analyzer'] = {
                 ...
            }
        }
    }
})

Am I doing something wrong?

[Feature Request] Expose get_server function

I'm trying to do something like this:

local lsp_installer = require('nvim-lsp-installer')
local _, server = lsp_installer.get_server("rust-analyzer")

if not server.is_installed() then
    server.install()
end

I want to do this so that I only install the language server if a specific plugin is loaded (in this case rust-tools.nvim).

But I'm unable to because the get_server function isn't exposed. Would it be possible to expose it?

Some servers fail to install when wget not availible

When a system doesn't have wget some servers fail to install.

Example:
LspInstall sumneko_lua

Error:

[INFO  Mon Oct  4 22:58:34 2021] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:286: Starting install server_name="sumneko_lua", requested_version="N/A"
[ERROR Mon Oct  4 22:58:34 2021] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:121: Failed to spawn process wget ENOENT: no such file or directory
[INFO  Mon Oct  4 22:58:34 2021] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:305: Installation completed server_name="sumneko_lua", success=false

Would be nice to send a message to message window with more info.

Error messages from the installation process are not logged

Description

I noticed while looking at #151 that there's no logging callback passed for the installation process itself. At least not for pip. I think it should be pretty straight forward to implement.

How to reproduce

I made a simple typo

-        installer = pip3.packages { "cmake-language-server" },
+        installer = pip3.packages { "cmake-language-servr" },

The error is forwarded correctly to the info panel as expected:
image

But this same information is lost or not available in the log file:

[DEBUG Fri 15 Oct 2021 08:37:41 AM CEST] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:133: Spawned with pid 26254
[DEBUG Fri 15 Oct 2021 08:37:42 AM CEST] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:119: Job pid=26254 exited with exit_code=1, signal=0
[INFO  Fri 15 Oct 2021 08:37:42 AM CEST] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:447: Installation completed server_name="cmake", success=false
[DEBUG Fri 15 Oct 2021 08:37:42 AM CEST] ...art/nvim-lsp-installer/lua/nvim-lsp-installer/server.lua:117: Uninstalling server cmake
[DEBUG Fri 15 Oct 2021 08:37:42 AM CEST] ...r/start/nvim-lsp-installer/lua/nvim-lsp-installer/fs.lua:14: fs: rmrf /home/hatsu/.local/share/nvim/lsp_servers/cmake
[DEBUG Fri 15 Oct 2021 08:38:38 AM CEST] ...nvim-lsp-installer/lua/nvim-lsp-installer/ui/display.lua:170: Deleting window

eslintls installation fails

To reproduce:

  1. Uninstall eslintls using LspUninstall eslintls
  2. Quit Neovim
  3. Install it back using LspInstall eslintls
  4. Get an erroneous output

image

LspInfo output

Configured servers: cssls, emmet_ls, tsserver, html, eslintls
Neovim logs at: /home/zlksnk/.cache/nvim/lsp.log

1 client(s) attached to this buffer: tsserver

Client: tsserver (id 1)
root: /home/zlksnk/personal/s
filetypes: javascript, javascriptreact, javascript.jsx, typescript, typescriptreact, typescript.tsx
cmd: /home/zlksnk/.local/share/nvim/lsp_servers/tsserver/node_modules/.bin/typescript-language-server --stdio

1 active client(s):

Client: tsserver (id 1)
root: /home/zlksnk/personal/s
filetypes: javascript, javascriptreact, javascript.jsx, typescript, typescriptreact, typescript.tsx
cmd: /home/zlksnk/.local/share/nvim/lsp_servers/tsserver/node_modules/.bin/typescript-language-server --stdio

Clients that match the filetype javascript:

Config: emmet_ls
filetype: No filetypes defined, please define filetypes in setup().

Config: tsserver
cmd: /home/zlksnk/.local/share/nvim/lsp_servers/tsserver/node_modules/.bin/typescript-language-server --stdio
cmd is executable: True
identified root: /home/zlksnk/personal/s
custom handlers:

Config: eslintls
filetype: No filetypes defined, please define filetypes in setup().

Version info:
Plugin commit: d10094c
Nvim version: NVIM v0.5.0-dev+1233-g82ac44d01 \ Build type: RelWithDebInfo
Node.js version: 14.16.0
NPM version: 6.14.11
Operating system: Ubuntu 20.04.2 LTS on Windows 10 x86_64

Additional information: NPM 6 uses v1 lockfile but eslintls uses v2.

LspInstall installs nothing with npm and installation logs cannot be found

:LspInstall pyright

After executing this, :LspInstallInfo says that the pyright server is installed successfully (installed today).

However, lsp servers can't start:

cmd ["$HOME/.local/share/nvim/lsp_servers/python/node_modules/.bin/pyright-langserver"] is not executable.

In the directory $HOME/.local/share/nvim/lsp_servers/ folders like python, tsserver, etc. are created but they are just empty directories.

FYI, I am using macOS and my neovim version is NVIM v0.6.0-dev+1556-gc642f3ac2 .

Plus, I cannot find any relevant log files; I wanted to show the output of installer scripts but apparently the GUI window doesn't have any feature. How can I debug this?

Help: Support for Windows

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 ?🤔

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.