Git Product home page Git Product logo

nvim-lspinstall's Introduction

⚠️ I don't have time to maintain this repository anymore. Please use https://github.com/williamboman/nvim-lsp-installer instead, it does the same thing but better.

logo

About

This is a very lightweight companion plugin for nvim-lspconfig. It adds the missing :LspInstall <language> command to conveniently install language servers.

The language servers are installed locally into stdpath("data"), you can use :echo stdpath("data") to find out which directory that is on your machine.

Isn't this something I should use my system's package manager for?

Installation

Via Vim-Plug

Plug 'neovim/nvim-lspconfig'
Plug 'kabouzeid/nvim-lspinstall'

The following is a good starting point to integrate with nvim-lspconfig.

require'lspinstall'.setup() -- important

local servers = require'lspinstall'.installed_servers()
for _, server in pairs(servers) do
  require'lspconfig'[server].setup{}
end

For a complete example you might refer to my personal configuration in the Wiki.

Usage

  • :LspInstall <language> to install/update the language server for <language> (e.g. :LspInstall python).
  • :LspUninstall <language> to uninstall the language server for <language>.
  • require'lspinstall'.setup() to make configs of installed servers available for require'lspconfig'.<server>.setup{}.

Advanced Configuration (recommended)

A configuration like this automatically reloads the installed servers after installing a language server via :LspInstall such that we don't have to restart neovim.

local function setup_servers()
  require'lspinstall'.setup()
  local servers = require'lspinstall'.installed_servers()
  for _, server in pairs(servers) do
    require'lspconfig'[server].setup{}
  end
end

setup_servers()

-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
require'lspinstall'.post_install_hook = function ()
  setup_servers() -- reload installed servers
  vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server
end

Bundled Installers

Language Language Server
angular Angular Language Service
bash bash-language-server
clojure clojure-lsp
cmake cmake-language-server
cpp clangd
csharp OmniSharp
css css-language-features (pulled directly from the latest VSCode release)
dockerfile docker-langserver
elixir Elixir Language Server (elixir-ls)
elm Elm Language Server (elm-ls)
ember Ember Language Server
fortran Fortran Language Server (fortls)
go gopls
graphql GraphQL language service
haskell haskell-language-server
html html-language-features (pulled directly from the latest VSCode release)
java Eclipse JDTLS with Lombok
json json-language-features (pulled directly from the latest VSCode release)
kotlin kotlin-language-server
latex texlab
lua (sumneko) lua-language-server
php intelephense
prisma prisma-language-server
puppet puppet-editor-services
purescript purescript-language-server
python pyright-langserver
ruby solargraph
rust rust-analyzer
svelte svelte-language-server
tailwindcss tailwindcss-intellisense (pulled directly from the latest VSCode extension)
terraform Terraform Language Server (terraform-ls)
typescript typescript-language-server
vim vim-language-server
vue vls (vetur)
yaml yaml-language-server
zig zls
Name Description
deno https://deno.land/
diagnosticls https://github.com/iamcco/diagnostic-languageserver
efm https://github.com/mattn/efm-langserver
rome https://rome.tools/

Note: css, json and html language servers are pulled directly from the latest VSCode release, instead of using the outdated versions provided by e.g. npm install vscode-html-languageserver-bin.

Custom Installer

Use require'lspinstall/servers'.<lang> = config to register a config with an installer. Here config is a LSP config for nvim-lspconfig, the only difference is that there are two additional keys install_script and uninstall_script which contain shell scripts to install/uninstall the language server.

The following example provides an installer for bash-language-server.

-- 1. get the default config from nvim-lspconfig
local config = require"lspinstall/util".extract_config("bashls")
-- 2. update the cmd. relative paths are allowed, lspinstall automatically adjusts the cmd and cmd_cwd for us!
config.default_config.cmd[1] = "./node_modules/.bin/bash-language-server"

-- 3. extend the config with an install_script and (optionally) uninstall_script
require'lspinstall/servers'.bash = vim.tbl_extend('error', config, {
  -- lspinstall will automatically create/delete the install directory for every server
  install_script = [[
  ! test -f package.json && npm init -y --scope=lspinstall || true
  npm install bash-language-server@latest
  ]],
  uninstall_script = nil -- can be omitted
})

Make sure to do this before you call require'lspinstall'.setup().

Note: don't replace the / with a . in the require calls above (see here if you're interested why).

Lua API

  • require'lspinstall'.setup()

  • require'lspinstall'.installed_servers()

  • require'lspinstall'.install_server(<lang>)

  • require'lspinstall'.post_install_hook

  • require'lspinstall'.uninstall_server(<lang>)

  • require'lspinstall'.post_uninstall_hook

  • require'lspinstall/servers'

  • require'lspinstall/util'.extract_config(<lspconfig-name>)

nvim-lspinstall's People

Contributors

akinsho avatar alisonjenkins avatar ankurs47 avatar aotarola avatar aserowy avatar bashton-ajenkins avatar cigrainger avatar connorlay avatar derektata avatar hexium310 avatar jameswalmsley avatar jedimahdi avatar josemarluedke avatar jqno avatar kabouzeid avatar mordechaihadad avatar mraxime avatar msricher avatar nogweii avatar notusknot avatar nryoung avatar polyzen avatar tapayne88 avatar thecontinium avatar viniciusmuller 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-lspinstall's Issues

Configure lsp Tailwind with Twin Marco

Hello everyone I'm working a project with TailwindCSS and Twin

The problem is when I'm working with twin it doesn't display any lsp for tailwind
Sample code with Twin:

<div tw="text-lg font-medium text-gray-900">

And I saw on Vscode implmentation which need to config their settings with

"scss.validate": false,
"editor.quickSuggestions": {
    "strings": true
},
"editor.autoClosingQuotes": "always",
"tailwindCSS.experimental.classRegex": [
    "tw`([^`]*)", // tw`...`
    "tw=\"([^\"]*)", // <div tw="..." />
    "tw={\"([^\"}]*)", // <div tw={"..."} />
    "tw\\.\\w+`([^`]*)", // tw.xxx`...`
    "tw\\(.*?\\)`([^`]*)" // tw(Component)`...`
],
"tailwindCSS.includeLanguages": {
  "typescript": "javascript",
  "typescriptreact": "javascript"
}

I'm wondering how do you guys implement this config on your lspconfig after you installed from lspinstall. TIA!

LspInstall on windows can't create directory

Well basically running LspInstall with any languages throws this back:
...ite\pack\packer\start\nvim-lspinstall\lua\lspinstall.lua:25: could not create directory latex function: builtin#18 ...ite\pack\packer\start\nvim-lspinstall\lua\lspinstall.lua:25: could not create directory json
Is there a workaround, or is it "it's not working on MY machine" type of thing?

segfault on installing lua lsp

:LspInstall lua
Install lua language server?
[Y]es, (C)ancel: nvim: ../src/nvim/ui_compositor.c:564: ui_comp_raw_line: Assertion `attrs[i] >= 0' failed.
❯ nvim --version
NVIM v0.5.0-dev+1165-ge5bef5974

wget dependacy errors on mac

Some LspInstall <arg> commands result in a call to wget. If this isn't installed (as it wasn't on my Mac) the process exits with the error

command not found: wget

I was able to install the typescript server just fine, but others (such as html) errored.

If this is a necessary dependacy I guess that should be documented? A simple brew install wget fixed the issue.

scrolling tsx files causes errors

Whenever I scroll up (<C-u>) I see the following errors in tsx files

Error detected while processing WinScrolled Autocommands for "*":
E5108: Error executing lua Vim:E866: (NFA regexp) Misplaced {

An easier way to update language servers

This is a feature request. An :LspUpdate command for updating out of date servers would be nice, as I wouldn't have to manually run :LspInstall for each of my installed servers to check if it has an update or not

Tailwindcss not working

Thank you for this plugin, it seems very useful!

This is my config:

local function setup_servers()
  require'lspinstall'.setup()
  local servers = require'lspinstall'.installed_servers()
  for _, server in pairs(servers) do
    require'lspconfig'[server].setup{}
  end
end

setup_servers()

-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
require'lspinstall'.post_install_hook = function ()
  setup_servers() -- reload installed servers
  vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server
end

I use nvim-compe, which has this config:

local has_compe, compe = pcall(require, 'compe')
if has_compe then
  compe.setup {
    enabled = true;
    autocomplete = true;
    debug = false;
    min_length = 1;
    preselect = 'enable';
    throttle_time = 80;
    source_timeout = 200;
    incomplete_delay = 400;
    max_abbr_width = 100;
    max_kind_width = 100;
    max_menu_width = 100;
    documentation = true;

    source = {
      path = true;
      buffer = true;
      calc = true;
      nvim_lsp = true;
      nvim_lua = true;
      ultisnips = true;
      spell = true;
      tags = true;
      nvim_treesitter = true;
    };
  }
end

I have installed the tailwindcss lsp server, and it seems to be functioning:


  Configured servers: tailwindcss 
  Neovim logs at: /Users/brandoncc/.cache/nvim/lsp.log 
   
  1 client(s) attached to this buffer: tailwindcss 
   
    Client: tailwindcss (id 1) 
    	root:      /Users/brandoncc/dev/timely 
    	filetypes: aspnetcorerazor, blade, django-html, edge, ejs, erb, gohtml, haml, handlebars, hbs, html, html-eex, jade, leaf, liquid, markdown, mdx, mustache, njk, nunjucks, php, razor, slim, twig, css, less, postcss, sass, scss, stylus, sugarss, javascript, javascriptreact, reason, rescript, typescript, typescriptreact, vue, svelte 
    	cmd:       node ./tailwindcss-intellisense/extension/dist/server/index.js --stdio 
    	 
   
   
  1 active client(s):  
   
    Client: tailwindcss (id 1) 
    	root:      /Users/brandoncc/dev/timely 
    	filetypes: aspnetcorerazor, blade, django-html, edge, ejs, erb, gohtml, haml, handlebars, hbs, html, html-eex, jade, leaf, liquid, markdown, mdx, mustache, njk, nunjucks, php, razor, slim, twig, css, less, postcss, sass, scss, stylus, sugarss, javascript, javascriptreact, reason, rescript, typescript, typescriptreact, vue, svelte 
    	cmd:       node ./tailwindcss-intellisense/extension/dist/server/index.js --stdio 
    	 
   
   
  Clients that match the filetype typescriptreact.javascript.typescript.javascriptreact.javascript-react.javascript_react: 

and my lsp logs:

[ START ] 2021-04-01T23:52:27-0700 ] LSP logging initiated
[ WARN ] 2021-04-01T23:52:42-0700 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:108 ]	"The language server tailwindcss triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"

I don't understand why, but I don't get any completion recommendations. Am I doing something wrong?

Thanks!

Error installing efm

I have the following error installing efm

package github.com/mattn/efm-langserver@HEAD: invalid github.com/ import path "github.com/mattn/efm
-langserver@HEAD"

[Process exited 1]

Maintainer of efm said that it should not use @HEAD

Unable to add graphql-language-server

Hey thanks for your work on this plugins 👍🏿 .

I've just tried to add in an installer for graphql using the custom installer setup instructions and hit a blocking issue.

function as_utils.lsp.add_custom_installer()
  -- npm install -g graphql-language-service-cli
  local config = require('lspconfig').graphql.document_config
  require('lspconfig.configs').graphql = {default_config = {}} --This errors if nil is set <-------------
  config.default_config.cmd[1] = "./node_modules/.bin/graphql-language-service-cli"

  require('lspinstall.servers').graphql = vim.tbl_extend('error', config, {
      install_script = [[
      ! -f package.json && npm init -y --scope=lspinstall || true
      npm install graphql-language-service-cli@latest
      ]],
      uninstall_script = nil
    })
end

I do this before calling setup of the lspinstall plugin or doing any setup of the lsp itself using lspconfig however I /packer/opt/nvim-lspconfig/lua/lspconfig/configs.lua:10: attempt to index local 'config_def' (a nil value)
Looking at the code in lspconfig it seems to have a validation and looks like expects this field to not be nil so throws errors.
I tried setting it to an empty object which silences the error but doesn't give me the option to install the server

tailwindcss not giving autocompletion

Before writing this I looked at all the previous issues here, also I tried using the VSCode's tailwind extension in the cmd. No solution is working till now.

Using LspInfo my buffer is detecting tailwindcss and it is there in active client section. But it is not giving any completion at all in any files (I tried with html, html in angular, and vue files).

Is there something I am missing? Here is my setup for tailwind lsp.

Incomplete angular installer

From my, very rudimentary, understanding of the angular language server I believe the current config may be incomplete (feel free to correct me if that is not the case).

Currently the script, will install the language server and update the default cmd.
However, if we want to make use of the angular language server in a portable fashion, I believe it requires a typescript installation. So if I were to try and use it from its installed folder, it will trigger an error like so :

node node_modules/@angular/language-server/bin/ngserver --stdio --ngProbeLocations ./
/home/jemag/.local/share/nvim/lspinstall/angular/node_modules/@angular/language-server/index.js:157
      throw new Error(`Failed to resolve '${packageName}' with minimum version '${minVersion}' from ` + JSON.stringify(probeLocations, null, 2));
      ^

Error: Failed to resolve 'typescript/lib/tsserverlibrary' with minimum version '4.2' from [
  "--help"

Also the command does not specify the --tsProbeLocations and --ngProbeLocations. So if I am in an angular project called "Neptune" , LspInfo will return the following command used:
image

Which will not work if the project does not have @angular/language-service installed, or if the project uses a Typescript version < 4.2

Basically, I think it would make sense to also install typescript and properly set the --tsProbeLocations and --ngProbeLocations to the nvim-lspinstall's installed typescript and angular/language-service. Perhaps leaving the freedom to the user to change those, if needed.

For example, this was the previous basic setup that I was using to make angularls work:

local configPath = vim.fn.stdpath("config")
local languageServerPath = configPath.."/languageserver"
local angular_cmd = {"node", languageServerPath.."/node_modules/@angular/language-server/index.js", "--stdio", "--tsProbeLocations", languageServerPath, "--ngProbeLocations", languageServerPath}

require'lspconfig'.angularls.setup{
  on_attach = on_attach_common,
  cmd = angular_cmd,
  on_new_config = function(new_config,new_root_dir)
  new_config.cmd = angular_cmd
  end,
}

where languageserver is a folder containing the required dependencies (angular/language-server and typescript).

P.S.: For some reason, even with projects having typescript >4.2 and @angular/language-service installed, the current default configuration did not seem to work. Curious if you've made it work for some test angular projects?

"Client 1 quit with exit code 126 and signal 0" and "Client 1 quit with exit code 2 and signal 0" when opening/closing rust file.

Setup

Client

  • X86 Desktop
    • Manjaro OS XFCE
      • Alacritty

Server computer - connectiion via ssh

  • Raspberry Pi 4
    • Manjaro OS Minimal
      • neovim
        • lunarvim
          • nvim-lspinstall
          • rust-analyzer

Steps

  1. Open a .rs file.
  2. Close a .rs file.

First error appears when opening the rust file and the second one after closing the file.

~/.cache/nvim/lsp.log

...
[ ERROR ] 2021-05-17T20:23:43+0200 ] /usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:457 ]	"rpc"	
"/home/folaht/.local/share/nvim/lspinstall/rust/rust-analyzer"	
"stderr""/home/folaht/.local/share/nvim/lspinstall/rust/rust-analyzer: 
/home/folaht/.local/share/nvim/lspinstall/rust/rust-analyzer: cannot execute binary file: Exec format error
...

lspconfig can't load configs that were required by lspinstall

I installed the plugin, now it keeps accusing me of this error in every of my language config. Like, i had this:

require"lspconfig".html.setup {}
require"lspconfig".solargraph.setup {}
require"lspconfig".vimls.setup {}
require"lspconfig".cssls.setup {}

Then it appeared:

E5113: Error while calling lua chunk: /home/hrq/.config/nvim/lua/lsp/lspconfig.lua:39: attempt to index field 'sol
argraph' (a nil value)
Press ENTER or type command to continue

Then if i remove the solargraph line, it accused from the html, hen if i remove, it accuses for the vimls, and so on.

I removed all of them, now it's accusing the same on the sumneko_lua, which is configured like this:

local sumneko_root_path = vim.fn.stdpath('data') .. '/lspinstall/lua'
local sumneko_binary = sumneko_root_path .. '/sumneko-lua-language-server'

require'lspconfig'.sumneko_lua.setup {
    cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
    on_attach = require'lsp'.common_on_attach,
    settings = {
        Lua = {
            runtime = {
                -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
                version = 'LuaJIT',
                -- Setup your lua path
                path = vim.split(package.path, ';')
            },
            diagnostics = {
                -- Get the language server to recognize the `vim` global
                globals = {'vim'}
            },
            workspace = {
                -- Make the server aware of Neovim runtime files
                library = {[vim.fn.expand('$VIMRUNTIME/lua')] = true, [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true},
                maxPreload = 10000
            }
        }
    }
}

install_script is nil

I get this error when trying to install:

:LspInstall typescript                                                                                                                               
Install typescript language server?                                                                                                                  
                                                                                                                                                     
.../.config/nvim/plugged/nvim-lspinstall/lua/lspinstall.lua:38: attempt to concatenate field 'install_script' (a nil value) function: builtin#18 .../
.config/nvim/plugged/nvim-lspinstall/lua/lspinstall.lua:38: attempt to concatenate field 'install_script' (a nil value)                              
Press ENTER or type command to continue

All the files seem to be there, but I am not that familiar with lua.

SIGABRT when trying to install or uninstall lua

image

image

❯ nvim --version
NVIM v0.5.0-dev+1265-g66f9dd3c6
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az36-146

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

Trying it out on 4257e3f. I did notice that the installation failed. Here's the output of :LspInfo

image

Support fish shell

Currently experiencing a similar problem with the fish shell:

When trying to install lua:

fish: Unsupported use of '='. In fish, please use 'set os $(uname -s | tr "[:upper:]" "[:lower:]")'.

[Process exited 123]

When trying to install python, vim or bash:

set: Erase needs a variable name

Standard input (line 1):
set -e
^

(Type 'help set' for related documentation)
fish: Unknown command: '[[ ! -f package.json ]]'
fish:
  [[ ! -f package.json ]] && npm init -y --scope=lspinstall || true
  ^

up to date, audited 2 packages in 793ms

found 0 vulnerabilities

[Process exited 0]

Originally posted by @SandWoodJones in #9 (comment)

Error E5513 "init.lua:527: attempt to call field 'setup' (a nil value)"

Since commit 471603f I'm getting this error message when invoking an BufWritePost autocmd to reload init.lua after some changes:

    E5113: Error while calling lua chunk: $HOME/.config/nvim/init.lua:527: attempt to call field 'setup' (a nil value)

My config with regards to nvim-lspinstall follows the wiki:

-- configure language servers
local css_settings = {
  root_dir = vim.loop.cwd()
}
local lua_settings = {
  Lua = {
    runtime = { version = 'LuaJIT', path = vim.split(package.path, ';'), },
    diagnostics = {
      enable = true,
      globals = {'vim', 'use', 'describe', 'it', 'assert', 'before_each', 'after_each'},
    },
    workspace = {
      preloadFileSize = 400,
    },
  }
}
local php_settings = {
  root_dir = vim.loop.cwd()
}

local function make_config()
  local capabilities = vim.lsp.protocol.make_client_capabilities()
  capabilities = vim.tbl_extend('keep', capabilities, lsp_status.capabilities)
  capabilities.textDocument.completion.completionItem.snippetSupport = true
  capabilities.textDocument.completion.completionItem.resolveSupport = {
    properties = {
      'documentation',
      'detail',
      'additionalTextEdits',
    }
  }
  return {
    capabilities = capabilities,
    on_attach = on_attach,
  }
end

-- lsp-install
local function setup_servers()
  lsp_install.setup()
  local servers = lsp_install.installed_servers()
  for _, server in pairs(servers) do
    local config = make_config()
    if server == 'bash' then
      config.filetypes = { 'bash', 'sh', 'zsh' }
    end
    if server == 'css' then
      config.settings = css_settings
    end
    if server == 'lua' then
      config.settings = lua_settings
    end
    if server == 'php' then
      config.settings = php_settings
    end
    lsp_config[server].setup(config)
  end
end
setup_servers()

-- automatically reload after `:LspInstall <server>` so we don't have to restart neovim
lsp_install.post_install_hook = function ()
  setup_servers()
  vim.api.nvim_command[[bufdo e]] -- this triggers the FileType autocmd that starts the server
end

For a broader context how my config looks like you can always have a look at
https://github.com/wimstefan/dotfiles/blob/master/config/nvim/init.lua

zsh:2: command not found: -f

i have zsh set as my shell

neovim --version :

NVIM v0.5.0-dev+1166-g070e084a6
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az205-228

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

it seems to be successfully installed, but an error is still thrown. it does this for every lsp i tried

zsh:2: command not found: -f
Wrote to /home/mirsella/.local/share/nvim/lspinstall/vue/package.json:

{
  "name": "@lspinstall/vue",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": ""
}


npm WARN deprecated [email protected]: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more inform
ation.

added 139 packages, and audited 140 packages in 7m

18 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

[Process exited 0]

Clangd cpp install fail

It appears the curl request to get the platform clangd link returns 2 URLs (see below) resulting in this error:

Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning: <FILE>" to save to a file.

URLs:

https://github.com/clangd/clangd/releases/download/12.0.0/clangd-indexing-tools-mac-12.0.0.zip
https://github.com/clangd/clangd/releases/download/12.0.0/clangd-mac-12.0.0.zip

The error can be repeated by running this:

curl -L -o "clangd.zip" https://github.com/clangd/clangd/releases/download/12.0.0/clangd-indexing-tools-mac-12.0.0.zip https://github.com/clangd/clangd/releases/download/12.0.0/clangd-mac-12.0.0.zip

Config to require servers

Instead of having to manually install servers, include a config option where you can basically provide a list of language servers you need, so that lspinstall can automatically install them if they aren't already installed.

could not create directory

Hi, I don't want to be annoying but I really want to find a solution to the problem I'm having since I haven't seen it anywhere else and I'm really interested in using the plugin without having to patch it 😅.

When running :LspInstall lang I get the error could not create directory lang. As I had thought about the PR that for some reason the command was being executed with my version of Lua, I downgraded to lua 5.1 to make sure it wasn't that, and the same problem continues.

In case this information is useful for something:

  • Nvim version: NVIM v0.5.0-dev+1177-g095f5da79
  • doing os.execute("mkdir -p ".. path) inside Neovim returns true exit 0 as it would in newer versions of Lua (I don't understand why yet, if Lua 5.1 is supposed to be used in Neovim)

Thanks in advance 🙂

Java JDT.LS configuration error

I've installed and configured the Java language server, and when I open a Java file, the language server starts up correctly, but I get a warning in the first line that says <filename>.java is a non-project file, only syntax errors are reported. This is due to the fact that the -data parameter in the jdtls.sh is not configured correctly. It gets the name of the workspace, which is good (it prevents that data files from different projects get mixed up), but it needs an absolute path to work, not a relative path.

If we change this line:

-data "\$WORKSPACE" \\

to something like -data "$(pwd)/workspaces/\$WORKSPACE" \\ everything works fine.

It would be easy for me to create a PR for this, however, I'm not sure if the directory I chose here is the correct one. It seems like it should be in ~/.cache/nvim somewhere, but I'm not sufficiently up-to-date in Neovim's directory usage that I can say for certain. And if so, I also don't know what the best way would be to put that directory into the script without hard-coding it.

What do you think? I'm happy to provide a PR for this.

typescript lsp

I ran :LspInstall typescript, says it installed properly. But when I open up a index.js lsp, doesn't work. I have lsp working on other types (docker, lua, bash). I even tried it with projects with package.json in the root but still nothing. What am I missing?

jsonls doesn't correctly patch the command

The jsonls installer sets up the command such that it won't get patched correctly on require'lspinstall'.setup().

cmd = { "node", "./vscode-json/json-language-features/server/dist/node/jsonServerMain.js", "--stdio" },

This looks to be a limitation of the setup function in that it only patches the first command. Appreciate I definitely lack the context but could we update the setup function to patch all relative paths in the command? Doing so would likely remove the need for #53

Issues with pyright autocompletion

I am newbie to python programing and lua version of init.lua for nvim. I am using nvim nightly on WSL2 - Ubuntu 20.04
I normally try learning using simple "*.py" files kept in a folders in in my Win 10 side - which get mounted on WSL by /mnt/c/Users/XXX/python_tutorial/. I have installed pyright server using "kabouzeid/nvim-lspinstall" plugin in my init.lua
Everything - autocomplete works well when I have .py file in WSL $HOME folder., but when I try to run nvim on .py file on my /mnt/c/Users/XXX/python_tutorial/ the auto complete doesn't work. This issue didn't happen when I used earlier init.vim with coc pyroght server install.

After some reading through your Readme on you site I put an requirement.txt or setup.py on the win10 python folder and then the autocomplete seemed to work. Could this be set to work like the coc pyright server where this was not required . It would save a lot of hassles for a learner like me who might keep multiple py folders as per learning and not necessarily doing a project with setup.py or requirements.txt

Omnisharp not working

I am very happy with this plugin it works great except for csharp it seems omnisharp server started and is accepting commands but for some reason non of them work. When trying go to definition it responds with just:

[ INFO ] 2021-05-23T14:19:54+0200 ] ...AD-0cbe748_2/share/nvim/runtime/lua/vim/lsp/handlers.lua:292 ] "textDocument/definition" "No location found"

Tested on project created with dotnet new webapi --no-https

Any idea what might be wrong?

Attached Lsp not working

Hey I don't know if anyone would know why for the Rust Lsp if I open a file in another buffer the LSP even though it says attached doesn't provide any of it's functions such as autocompletion. In the video you'll see me

  1. Open my init.lua file and run LSP info showing only 1 Lua lsp attached and demonstrate LSP autocomplete and definitions working. I will then open another lua file and show that it still works and after running LSP info there is still only 1 attached.
  2. I will open my rust file and run LSP info showing 1 attached same as above and LSP working. BUT when I open a second the amount attached goes to 2 (maybe this is weird behaviour) after running LSP info and LSP will not work.
Untitled_.Apr.19.2021.7_35.PM.mp4

I honestly have no idea what's happening...I tried reloading the buffer and that didn't work either. Any ideas??

Java support

do you guys plan on adding support for java? I feel like automating the process of getting java to work would be very very helpful since right now its kind of a pain to get java setup 😄

Post install hook not working

Firstly, fantastic plugin. Exactly what's been missing in the community recently.

I notice that the post_install hook doesn't seem to refresh the buffers. But when I manually do bufdo e in the command line, the Lsp status is updated. I've included screenshot and my code below:

Screenshot

You can see the status of my LSP server in the status line and that my diagnostic signs appear when I run bufdo e
Screen Shot 2021-03-21 at 10 05 21

Code

local function on_attach(client, bufnr)

    -- Omni completion in insert mode
    vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')

    if client.resolved_capabilities.document_highlight then
    --     utils.create_higroup({
    --         { 'LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow' },
    --         { 'LspReferenceText cterm=bold ctermbg=red guibg=LightYellow' },
    --         { 'LspReferenceWrite cterm=bold ctermbg=red guibg=LightYellow' },
    --     })
        utils.create_augroup({
            { 'CursorHold <buffer> lua vim.lsp.buf.document_highlight()' },
            { 'CursorMoved <buffer> lua vim.lsp.buf.clear_references()' },
        }, 'lsp_document_highlight')
    end

    if client.resolved_capabilities.document_formatting then
        utils.map("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", { silent = true })
    elseif client.resolved_capabilities.document_range_formatting then
        utils.map("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", { silent = true })
    end
    
    if client.resolved_capabilities.implementation then
        utils.map("n", "gD", "vim.lsp.buf.implementation()")
    end

    if client.resolved_capabilities.code_action then
        cmd 'packadd nvim-lightbulb'
        cmd 'autocmd CursorHold,CursorHoldI * lua require\'nvim-lightbulb\'.update_lightbulb()'
    end

    if has_lspsaga then
        utils.map_lua("n", "ga", "require('lspsaga.codeaction').code_action()")
        utils.vmap_lua("ga", "require('lspsaga.codeaction').range_code_action()")
        utils.map_lua("n", "gf", "require('lspsaga.provider').lsp_finder()")
        utils.map_lua("n", "gd", "require('lspsaga.provider').preview_definition()")
        utils.map_lua("n", "gs", "require('lspsaga.signaturehelp').signature_help()")
        utils.map_lua("n", "gr", "require('lspsaga.rename').rename()")
        utils.map_lua("n", "K", "require('lspsaga.hover').render_hover_doc()")
        -- diagnostic
        utils.map_lua("n","<space>d","require('lspsaga.diagnostic').show_line_diagnostics()")
        utils.map_lua("n","gn","require('lspsaga.diagnostic').lsp_jump_diagnostic_next()")
        utils.map_lua("n","gp","require('lspsaga.diagnostic').lsp_jump_diagnostic_prev()")
    end
end

local function make_config()
    local capabilities = vim.lsp.protocol.make_client_capabilities()
    capabilities.textDocument.completion.completionItem.snippetSupport = true
    return {
      -- enable snippet support
      capabilities = capabilities,
      -- map buffer local keybindings when the language server attaches
      on_attach = on_attach,
    }
end

function setup_servers()
    require('lspinstall').setup()
  
    -- get all installed servers
    local servers = require('lspinstall').installed_servers()
    -- ... and add manually installed servers
    table.insert(servers, "efm")
  
    for _, server in pairs(servers) do
      local config = make_config()
  
      -- language specific config
      if server == "lua" then
        config.settings = lua_settings
      end
      if server == "efm" then
        config.settings = efm_settings
      end
      
      require('lspconfig')[server].setup(config)
    end
end

function config()

    cmd 'packadd nvim-lspconfig'
    local lspconfig = require('lspconfig')

    -- Enable icons in the completion menu
    if has_lspkind then
        require('lspkind').init()
    end
    -- Enable the cool hover menus but don't show the icons
    if has_lspsaga then
        require('lspsaga').init_lsp_saga({
            use_saga_diagnostic_sign = false,
            code_action_prompt = {
                enable = false,
                sign = false,
                sign_priority = 20,
                virtual_text = false,
            },
        })
    end

    setup_servers()
end
---------------------------------------------------------------------------- }}}

-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
require('lspinstall').post_install_hook = function ()
    print("installing")
    setup_servers() -- reload installed servers
    vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server
end

server installed but not able to attach?

I have run :LspInstall python to correctly (no erros) installed language server for python, but when I open a .py file in my project, and execute :LspInfo, it gets this message:

Configured servers:
Neovim logs at: /home/winkee/.cache/nvim/lsp.log

0 client(s) attached to this buffer:

0 active client(s):

Clients that match the filetype python:

OS: Ubuntu 20.04
Python: python 3.8.6
Neovim: v0.5.0-dev

Snippets would be cool

CoC regularly came with snippets, I have few on my GitHub for html Python Java you can checkout.

VSCode has a native html one now we may be able to tap into.

vsnip supports all VSCode formatted snippets and would be nice to get everything working out of the box, although I could see how this may be a separate concern.

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.