vonheikemen / lsp-zero.nvim Goto Github PK
View Code? Open in Web Editor NEWA starting point to setup some lsp related features in neovim.
Home Page: https://lsp-zero.netlify.app/v3.x/
License: MIT License
A starting point to setup some lsp related features in neovim.
Home Page: https://lsp-zero.netlify.app/v3.x/
License: MIT License
would be great if we could have something that allows us to pass configs conditionally to servers, insead of having to edit my files for every server i install and add a lsp.configure() for every server. prefereably it would take a callback that can accept the name of the language server and returns the same settings table configure does e.g.
lsp-zero.bulk_configure(function(server) ... end)
in my usecase specifically it would end up looking like this
lsp-zero.bulk_configure(function(server)
local config_exists, config = pcall(require, "lsp.settings." .. server.name)
if config_exists then
return config
end
return {}
end)
this way we can configure a way of initialising all servers quickly and easily and allowing newly installed servers to automatically start without having to edit the nvim script and add a configure for the new server
Originally posted by @Lite5h4dow in #1 (comment)
Hey, just tried this thing out tonight and found that I'm back to an old problem in my Deno project: A project needing Denols lsp is detected as a tsserver project. Deno has a recommended strategy for dealing with this problem on their website, which is to configure tsserver and denols like so:
nvim_lsp.denols.setup {
on_attach = on_attach,
root_dir = nvim_lsp.util.root_pattern("deno.json"),
init_options = {
lint = true,
},
}
nvim_lsp.tsserver.setup {
on_attach = on_attach,
root_dir = nvim_lsp.util.root_pattern("package.json"),
init_options = {
lint = true,
},
}
https://deno.land/[email protected]/getting_started/setup_your_environment
It's not an ideal solution for every case, but it's worked well for me.
Today I updated my plugins via PlugUpdate
and afterward my installed LSP servers list shown via :LspInstallInfo
was a lot shorter than before. The servers that were not shown, such as gopls
, would not start unless I ran :LspZeroSetupServers gopls
. I tried to reinstall it and it appeared successful, but after closing and opening neovim it was no longer listed as installed. I have verified that it is installed in ~/.local/share/nvim/lsp_servers
. This behavior repeated itself after upgrading my plugins on my personal machine. I've also tried removing and reinstalling plugins, removing and reinstalling all language servers, but the result is the same. It shows all of the langauge servers installed, but most of them disappear ofter closing and reopening neovim.
Here is my neovim configuration:
" Options
set hidden
set relativenumber
set nu
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
set smartindent
set guicursor=
set nowrap
set nobackup
set noswapfile
set undodir=~/.config/nvim/undodir
set undofile
set scrolloff=10
set colorcolumn=80
set showcmd
set ignorecase
set smartcase
set mouse=a
set cmdheight=2
set termguicolors
set confirm
" Non-plugin maps
let mapleader = ','
nnoremap <F1> :tabp <CR>
inoremap <F1> <C-o>:tabp <CR>
nnoremap <F2> :tabn <CR>
inoremap <F2> <C-o>:tabn <CR>
nnoremap ]q :cnext <CR>
nnoremap [q :cprevious <CR>
" Plugins
call plug#begin('~/.config/nvim/plugged')
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'bluz71/vim-nightfly-guicolors'
Plug 'tpope/vim-fugitive'
Plug 'lewis6991/gitsigns.nvim'
Plug 'vim-airline/vim-airline'
Plug 'nvim-lua/plenary.nvim'
Plug 'ThePrimeagen/harpoon'
Plug 'numToStr/Comment.nvim'
Plug 'hoschi/yode-nvim'
" LSP
Plug 'neovim/nvim-lspconfig'
Plug 'williamboman/nvim-lsp-installer'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'saadparwaiz1/cmp_luasnip'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-nvim-lua'
Plug 'L3MON4D3/LuaSnip'
Plug 'rafamadriz/friendly-snippets'
Plug 'VonHeikemen/lsp-zero.nvim'
call plug#end()
" Harpoon Config
lua << EOF
require('harpoon').setup({
global_settings = {
mark_branch = true,
}
})
EOF
nnoremap <leader>hh :lua require('harpoon.mark').add_file()<CR>
nnoremap <leader>hf :lua require('harpoon.ui').toggle_quick_menu()<CR>
nnoremap <leader>hn :lua require('harpoon.ui').nav_next()<CR>
nnoremap <leader>hp :lua require('harpoon.ui').nav_prev()<CR>
" Yode Config
lua << EOF
require('yode-nvim').setup({})
EOF
map <leader>yy :YodeCreateSeditorFloating<CR>
map <leader>yd :YodeBufferDelete<CR>
" LSP Config
lua << EOF
local lsp = require('lsp-zero')
lsp.ensure_installed({
'bashls',
'clangd',
'cmake',
'cssls',
'dockerls',
'eslint',
'gopls',
'jsonls',
'ltex',
'pyright',
'sumneko_lua',
'texlab',
'vimls',
})
lsp.preset('recommended')
lsp.set_preferences({
set_lsp_keymaps = false
})
lsp.on_attach(function(client, bufnr)
local noremap = {noremap = true}
local map = function(...) vim.api.nvim_buf_set_keymap(0, ...) end
map('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<CR>', noremap)
map('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', noremap)
map('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', noremap)
map('n', 'gr', '<cmd>lua vim.lsp.buf.rename()<cr>', noremap)
map('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', noremap)
map('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', noremap)
map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', noremap)
map('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', noremap)
map('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', noremap)
map('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<CR>', noremap)
map('n', 'gc', '<cmd>lua vim.lsp.buf.references()<CR>', noremap)
map('n', 'gf', '<cmd>lua vim.lsp.buf.formatting()<CR>', noremap)
map('n', 'ga', '<cmd>lua vim.lsp.buf.code_action()<CR>', noremap)
end)
lsp.setup()
EOF
" Treesitter Config
lua << EOF
require'nvim-treesitter.configs'.setup {
ensure_installed = 'all',
ignore_install = { 'phpdoc' },
highlight = {
enable = true,
},
}
EOF
" FZF Config
nnoremap <leader>pf :Files <CR>
nnoremap <leader>pg :GFiles <CR>
nnoremap <leader>ph :Files '~' <CR>
nnoremap <leader>pb :Buffers <CR>
nnoremap <leader>pr :Rg <CR>
nnoremap <leader>pl :Lines <CR>
let $FZF_DEFAULT_OPTS = '--layout=reverse --info=inline'
let $FZF_DEFAULT_COMMAND='rg --files --hidden -S'
" Fugitive Config
nnoremap <leader>gs :G <CR>
nnoremap <leader>gb :Git blame <CR>
nnoremap <leader>gp :Git push <CR>
nnoremap <leader>gc :!gc <CR>
nnoremap <leader>gn :Git commit --no-verify <CR>
" Gitsigns Config
lua << EOF
require("gitsigns").setup()
EOF
nnoremap [c :Gitsigns prev_hunk<CR>
nnoremap ]c :Gitsigns next_hunk<CR>
nnoremap <leader>hs :Gitsigns stage_hunk<CR>
nnoremap <leader>hr :Gitsigns reset_hunk<CR>
nnoremap <leader>hS :Gitsigns stage_buffer<CR>
nnoremap <leader>hR :Gitsigns reset_buffer<CR>
nnoremap <leader>hu :Gitsigns undo_stage_hunk<CR>
nnoremap <leader>hp :Gitsigns preview_hunk<CR>
nnoremap <leader>hq :Gitsigns setqflist<CR>
nnoremap <leader>hd :Gitsigns toggle_deleted<CR>
nnoremap <leader>hD :Gitsigns diffthis<CR>
nnoremap <leader>ha :Gitsigns select_hunk<CR>
" Comments Config
lua << EOF
require('Comment').setup {
opleader = {
line = "<leader>c",
block = "<leader>b",
},
toggler = {
line = "<leader>cc",
block = "<leader>bc",
},
mappings = {
basic = true,
extra = false,
extended = false,
},
}
EOF
" Colorscheme
colorscheme nightfly
highlight Normal guibg=none
" Autocommands
fun! TrimWhitespace()
let l:save = winsaveview()
keeppatterns %s/\s\+$//e
call winrestview(l:save)
endfun
augroup ENIGMA
autocmd!
autocmd BufWritePre * :call TrimWhitespace()
autocmd BufWritePost *.go :silent !goimports -w '%:p'
autocmd FileType go nnoremap <leader>ll :cexpr system('golint ' . shellescape(expand('%:p')))<CR>:copen<CR>
autocmd FileType go nnoremap <leader>lr :cexpr system('__golint_root')<CR>:copen<CR>
augroup END
" Neovide Config
let g:neovide_transparency = 0.8
let g:neovide_cursor_vfx_mode = "pixiedust"
let g:neovide_cursor_animation_length = 0.05
let g:neovide_cursor_vfx_particle_density = 40.0
let g:neovide_cursor_vfx_particle_speed = 30.0
let g:neovide_cursor_trail_length = 1.0
Here is :LspInstallInfo
just after deleting ~/.local/share/nvim/lsp_installers
and opening nvim, triggering the server in my ensure installed list to be installed:
I love this plugin, really stream lining this whole process.
The one thing i am trying to figure out is how to override some of cmp's options. It looks like setup calls run and run calls the setup to cmp, but i have no way to merge in some options.
I just want to be able to have some of own binds (such as C-n/p for next/prev autocomplete, C-y for accept current autocomplete)
Thoughts?
Hi there,
I'm trying to remove underlines from diagnostics. Before I just did vim.diagnostic.config { underline = false }
and I thought I would be able to do something similar inside lsp.set_preferences
but I can't seem to figure out how.
I was able to do what I want by setting configure_diagnostics
to false
, but then I need to manually configure everything. How can I just set underline = false
?
Thanks!
Two examples I've run into issues with are 'denols' and 'tailwindcss-language-server'. If I install denols through mason, a typescript file will detect both tsserver and denols when I really only want one to attach. Similarly, having tailwind lsp installed never attaches even if I'm in a workspace with a tailwind.config.cjs. Is there a way to configure lsp zero on per lsp basis what file to look for to determine whether or not to attach? Am I doing something wrong?
I want to extend the default mapping of nvim-cmp.
Now I have to do something like this
local cmp_mapping = lsp.defaults.cmp_mappings()
cmp_mapping['<C-p>'] = cmp.mapping.select_prev_item()
cmp_mapping['<C-n>'] = cmp.mapping.select_next_item()
lsp.setup_nvim_cmp {
mapping = cmp_mapping
}
Can you provide capabilities to extend the default mapping just like in nvim-cmp. Something like this will be better.
lsp.setup_nvim_cmp {
mapping = lsp.defaults.cmp_mappings.insert({
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
})
}
Thank you
Not able to setup null-ls with your comment #17 (comment), even with the necessary formatters set in Mason.
What's the best way to approach this?
Hi,
thanks for the great tool.
I switched from nvim-lspconfig to LSP-zero and so far, everything works great.
Although there is one missing functionality for me: auto include of dependencies for C++ from the standard library.
For instance, if we create a new empty main.cpp:
int main (int argc, char *argv[])
{
std::vec // no include (#include <vector>) and autocompletion for std::vector
return 0;
}
Previously with nvim-lspconfig, there has been a suggestion to auto-complete std::vector, triggering the necessary include.
From my understanding, the cmp documentation mentions that this should be possible when the capabilities are set accordingly, which should be the default.
Unfortunately, this does not seem to have any effect.
I used the default config, as shown in your Readme.
Thanks so much
I want to integrate with null-ls plugins to handle linting & formatting buffer. But when I passed the on_attach function (below), all the keybindings has gone. So can you export the default on_attach before setup?
function(client, bufnr)
client.server_capabilities.documentRangeFormattingProvider = false
if client.supports_method "textDocument/formatting" then
vim.api.nvim_clear_autocmds { group = augroup, buffer = bufnr }
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format {
bufnr = bufnr,
filter = function(filtered_client)
return filtered_client.name == "null-ls"
end,
}
end,
})
end
end
I have the following in my init.lua (using packer):
use {
'VonHeikemen/lsp-zero.nvim',
requires = {
-- LSP Support
{'neovim/nvim-lspconfig'},
{'williamboman/mason.nvim'},
{'williamboman/mason-lspconfig.nvim'},
-- Autocompletion
{'hrsh7th/nvim-cmp'},
{'hrsh7th/cmp-buffer'},
{'hrsh7th/cmp-path'},
{'saadparwaiz1/cmp_luasnip'},
{'hrsh7th/cmp-nvim-lsp'},
{'hrsh7th/cmp-nvim-lua'},
-- Snippets
{'L3MON4D3/LuaSnip'},
{'rafamadriz/friendly-snippets'},
}
}
& the following in my lsp-zero config file:
local lsp = require('lsp-zero')
lsp.preset('recommended')
lsp.setup()
It let me install the lua-language-server when I first installed it & reopened my init.lua file, but no other language servers have been able to install successfully. All the ones I've tried fail with the message in the title.
Looks like there's no way to customize nvim-cmp
completion window appearance with setup_nvim_cmp()
. I guess you can always hack directly into nvim-cmp
configuration, but it defeats purpose of lsp-zero
in my opinion.
I gave it a shot and this patch makes it work for me:
diff --git a/lua/lsp-zero/nvim-cmp-setup.lua b/lua/lsp-zero/nvim-cmp-setup.lua
index 040c2e5d2afd..0b85fe3f522e 100644
--- a/lua/lsp-zero/nvim-cmp-setup.lua
+++ b/lua/lsp-zero/nvim-cmp-setup.lua
@@ -181,6 +181,10 @@ M.call_setup = function(opts)
config.preselect = opts.preselect
end
+ if type(opts.window) == 'table' then
+ config.window = merge(config.window, opts.window)
+ end
+
cmp.setup(config)
end
With this patch I can do this:
lsp.setup_nvim_cmp({
window = {
completion = cmp.config.window.bordered({
border = 'none',
side_padding = 0,
col_offset = -2,
}),
},
})
Although, I am not sure how it fits with the rest of setup_nvim_cmp()
interface. Like documentation window already can be customized with opts.documentation
already that translated into config.window.documetation
on nvim-cmp
side.
When using the recommended preset, there are no completions for imports in python
for this statemet:
from foo import <Tab>
which just inputs the tab character.
Edit: sorry, c++ includes actually work...
I've looked into what it would take to have lsp related info such as server status and diagnostics in a status line and it seems like a lot of hooking up work. Perhaps another task for lsp-zero?
First of all, thanks for the amazing work it is extremely helpful.
I did have one request, while I would like to use nvim-cmp
in general, I usually have very little interest in the snippets it provides. Would it be possible to have a simple way of expressing that I don't want the snippets without making the setup fully manual?
Perhaps another solution is the ordering, because the snippet suggestions are often higher in the list of suggestions than fields and methods which is super inconvenient.
As described in "Advanced usage", keybindings can be unmapped.
I tried to unmap Ctrl-k ("C-k") keybinding, as I use it for quick switch between windows (C-h/j/k/l). The method described above does't work, as "C-k" is not in "default_mappings".
Even more, I can't just remap this keybinding, because it seems to be mapped in on_attach callback for each LSP-enabled buffer.
lsp-zero.nvim/lua/lsp-zero/server.lua
Line 148 in fb9ae91
Is there any way to get control over those mappings too?
My css files no longer have any highlighting.
I have tailwindcss lsp installed checked using mason. I tried reinstalling and checking LspInfo says it exists but not attached.
I get an error every time I start nvim with css.
st(n);break;case gn.First:this.addItemFirst(n);break;case gn.Last:this.addItemLast(n);break;default:this.addItemLast(n);break}this._map.set(e,n),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let H=this[5/566]
et(e);if(!!H)return this._map.delete(e),this.removeItem(H),this._size--,H.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error(\"Invalid list\");let e=this._head;return this._map.delete(e.ke
y),this.removeItem(e),this._size--,e.value}forEach(e,H){let r=this._state,n=this._head;for(;n;){if(H?e.bind(H)(n.value,n.key,this):e(n.value,n.key,this),this._state!==r)throw new Error(\"LinkedMap got modified during iteration.\")
;n=n.next}}keys(){let e=this._state,H=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error(\"LinkedMap got modified during iteration.\");if(H){let n={value:H.key,done:!1};return H=H.next,n}else return
{value:void 0,done:!0}}};return r}values(){let e=this._state,H=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error(\"LinkedMap got modified during iteration.\");if(H){let n={value:H.value,done:!1};re
turn H=H.next,n}else return{value:void 0,done:!0}}};return r}entries(){let e=this._state,H=this._head,r={[Symbol.iterator]:()=>r,next:()=>{if(this._state!==e)throw new Error(\"LinkedMap got modified during iteration.\");if(H){let
n={value:[H.key,H.value],done:!1};return H=H.next,n}else return{value:void 0,done:!0}}};return r}[(X8=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let
H=this._head,r=this.size;for(;H&&r>e;)this._map.delete(H.key),H=H.next,r--;this._head=H,this._size=r,H&&(H.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._he
ad,this._head.previous=e;else throw new Error(\"Invalid list\");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error(\"I
nvalid list\");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error(\"Invalid list\");e.next.previous=void 0,this._head=e
.next}else if(e===this._tail){if(!e.previous)throw new Error(\"Invalid list\");e.previous.next=void 0,this._tail=e.previous}else{let H=e.next,r=e.previous;if(!H||!r)throw new Error(\"Invalid list\");H.previous=r,r.next=H}e.next=vo
id 0,e.previous=void 0,this._state++}touch(e,H){if(!this._head||!this._tail)throw new Error(\"Invalid list\");if(!(H!==gn.First&&H!==gn.Last)){if(H===gn.First){if(e===this._head)return;let r=e.next,n=e.previous;e===this._tail?(n.n
ext=void 0,this._tail=n):(r.previous=n,n.next=r),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(H===gn.Last){if(e===this._tail)return;let r=e.next,n=e.previous;e===this._head?(r.previo
us=void 0,this._head=r):(r.previous=n,n.next=r),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((H,r)=>{e.push([r,H])}),e}fromJSON(e){this.clear();for(let[H,
r]of e)this.set(H,r)}};Ma.LinkedMap=B1;var V8=class extends B1{constructor(e,H=1){super();this._limit=e,this._ratio=Math.min(Math.max(0,H),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){r
eturn this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,H=gn.AsNew){return super.get(e,H)}peek(e){return super.get(e,gn.None)}set(e,H){return super.set(e,H,gn.Last),this.checkTrim(),this}checkTr
im(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};Ma.LRUCache=V8});var dl=P(ju=>{\"use strict\";Object.defineProperty(ju,\"__esModule\",{value:!0});ju.Emitter=ju.Event=void 0;var uue=Ca(),cue;(functio
n(t){let e={dispose(){}};t.None=function(){return e}})(cue=ju.Event||(ju.Event={}));var G8=class{add(e,H=null,r){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(H),Array.isArray(
r)&&r.push({dispose:()=>this.remove(e,H)})}remove(e,H=null){if(!this._callbacks)return;let r=!1;for(let n=0,i=this._callbacks.length;n<i;n++)if(this._callbacks[n]===e)if(this._contexts[n]===H){this._callbacks.splice(n,1),this._con
texts.splice(n,1);return}else r=!0;if(r)throw new Error(\"When adding a listener with a context, you should remove it with the same context\")}invoke(...e){if(!this._callbacks)return[];let H=[],r=this._callbacks.slice(0),n=this._c
ontexts.slice(0);for(let i=0,s=r.length;i<s;i++)try{H.push(r[i].apply(n[i],e))}catch(a){(0,uue.default)().console.error(a)}return H}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this
._contexts=void 0}},tp=class{constructor(e){this._options=e}get event(){return this._event||(this._event=(e,H,r)=>{this._callbacks||(this._callbacks=new G8),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty(
)&&this._options.onFirstListenerAdd(this),this._callbacks.add(e,H);let n={dispose:()=>{!this._callbacks||(this._callbacks.remove(e,H),n.dispose=tp._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&
&this._options.onLastListenerRemove(this))}};return Array.isArray(r)&&r.push(n),n}),this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._ca
llbacks=void 0)}};ju.Emitter=tp;tp._noop=function(){}});var Z1=P(zu=>{\"use strict\";Object.defineProperty(zu,\"__esModule\",{value:!0});zu.CancellationTokenSource=zu.CancellationToken=void 0;var lue=Ca(),fue=pl(),X1=dl(),V1;(func
tion(t){t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:X1.Event.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:X1.Event.None});function e(H){let r=H;return r&&(r===t.
None||r===t.Cancelled||fue.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}t.is=e})(V1=zu.CancellationToken||(zu.CancellationToken={}));var hue=Object.freeze(function(t,e){let H=(0,lue.default)().timer.setTimeout(
t.bind(e),0);return{dispose(){H.dispose()}}}),G1=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){
return this._isCancelled}get onCancellationRequested(){return this._isCancelled?hue:(this._emitter||(this._emitter=new X1.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Z8=c
lass{get token(){return this._token||(this._token=new G1),this._token}cancel(){this._token?this._token.cancel():this._token=V1.Cancelled}dispose(){this._token?this._token instanceof G1&&this._token.dispose():this._token=V1.None}};
zu.CancellationTokenSource=Z8});var j8=P(wa=>{\"use strict\";Object.defineProperty(wa,\"__esModule\",{value:!0});wa.ReadableStreamMessageReader=wa.AbstractMessageReader=wa.MessageReader=void 0;var K1=Ca(),_l=pl(),j1=dl(),pue;(func
tion(t){function e(H){let r=H;return r&&_l.func(r.listen)&&_l.func(r.dispose)&&_l.func(r.onError)&&_l.func(r.onClose)&&_l.func(r.onPartialMessage)}t.is=e})(pue=wa.MessageReader||(wa.MessageReader={}));var z1=class{constructor(){th
is.errorEmitter=new j1.Emitter,this.closeEmitter=new j1.Emitter,this.partialMessageEmitter=new j1.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){
this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessa
geEmitter.fire(e)}asError(e){return e instanceof Error?e:new Error(`Reader received error. Reason: ${_l.string(e.message)?e.message:\"unknown\"}`)}};wa.AbstractMessageReader=z1;var J1;(function(t){function e(H){let r,n,i,s=new Map
,a,o=new Map;if(H===void 0||typeof H==\"string\")r=H??\"utf-8\";else{if(r=H.charset??\"utf-8\",H.contentDecoder!==void 0&&(i=H.contentDecoder,s.set(i.name,i)),H.contentDecoders!==void 0)for(let u of H.contentDecoders)s.set(u.name,
u);if(H.contentTypeDecoder!==void 0&&(a=H.contentTypeDecoder,o.set(a.name,a)),H.contentTypeDecoders!==void 0)for(let u of H.contentTypeDecoders)o.set(u.name,u)}return a===void 0&&(a=(0,K1.default)().applicationJson.decoder,o.set(a
.name,a)),{charset:r,contentDecoder:i,contentDecoders:s,contentTypeDecoder:a,contentTypeDecoders:o}}t.fromOptions=e})(J1||(J1={}));var K8=class extends z1{constructor(e,H){super();this.readable=e,this.options=J1.fromOptions(H),thi
s.buffer=(0,K1.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeou
t(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;let H=this.readable.onData(r=>{this.onData(r)});return this.readable.onError(r=>this.fi
reError(r)),this.readable.onClose(()=>this.fireClose()),H}onData(e){for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let n=this.buffer.tryReadHeaders();if(!n)return;let i=n.get(\"Content-Length\");if(!i)throw new Error
(\"Header must provide a Content-Length property.\");let s=parseInt(i);if(isNaN(s))throw new Error(\"Content-Length value must be a number.\");this.nextMessageLength=s}let H=this.buffer.tryReadBody(this.nextMessageLength);if(H===v
oid 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1;let r;this.options.contentDecoder!==void 0?r=this.options.contentDecoder.decode(H):r=Promise.resolve(H),r.then(n=>{this.options.
contentTypeDecoder.decode(n,this.options).then(i=>{this.callback(i)},i=>{this.fireError(i)})},n=>{this.fireError(n)})}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTim
er=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,K1.default)().timer.setTimeout((e,H)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(thi
s.firePartialMessage({messageToken:e,waitingTime:H}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};wa.ReadableStreamMessageReader=K8});var J8=P(TE=>{\"use strict\";Ob
ject.defineProperty(TE,\"__esModule\",{value:!0});TE.Semaphore=void 0;var due=Ca(),z8=class{constructor(e=1){if(e<=0)throw new Error(\"Capacity must be greater than 0\");this._capacity=e,this._active=0,this._waiting=[]}lock(e){ret
urn new Promise((H,r)=>{this._waiting.push({thunk:e,resolve:H,reject:r}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,due.default)().timer.setImmediate(()=
>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error(\"To many thunks active\");try{let H=e.thun
k();H instanceof Promise?H.then(r=>{this._active--,e.resolve(r),this.runNext()},r=>{this._active--,e.reject(r),this.runNext()}):(this._active--,e.resolve(H),this.runNext())}catch(H){this._active--,e.reject(H),this.runNext()}}};TE.
Semaphore=z8});var Hk=P(Ta=>{\"use strict\";Object.defineProperty(Ta,\"__esModule\",{value:!0});Ta.WriteableStreamMessageWriter=Ta.AbstractMessageWriter=Ta.MessageWriter=void 0;var Y8=Ca(),Hp=pl(),_ue=J8(),Q8=dl(),Lue=\"Content-Le
ngth: \",ek=`\\r\n
Hello,
Excellent work with this plugin! Greatly minimizes the boilerplate code :)
Would it be possible to support cmp-cmdline? I tried to use setup_nvim_cmp but couldn't get it to work.
Thank you!
Hi,
I want to pass cmp.config.window.bordered
to enable bordered completion menu. Currently I saw it was not expose for configured.
Thanks for this awesome lsp plugin 🎉
Following up from this tweet.
So, I shouldn't bother trying if I currently intend to provide the servers myself?
Is there a way to configure the plugin to use the local language server instead of the one installed be Mason?
Would probably be helpful to have. Could it be the same as for vim.lsp.buf.code_action()
but in mode x
?
Hello,
I enjoy using lsp-zero
with mason.nvim
, especially on my java projects.
However I have problem with .tsx
files. When I start nvim and open a .tsx
file, the typescript language server starts after a couple of seconds.Everything works fine. But if I open another file in another tab or go to another file, the tsserver
de-attach itself and I have to start it manually with :LspStart tsserver
.
This problem doesn't occurs for example on java files.
So here is my lsp.lua
file:
local lsp = require("lsp-zero")
lsp.preset("recommended")
lsp.ensure_installed({
'jdtls',
'tsserver',
'eslint',
'sumneko_lua',
'rust_analyzer',
})
-- Fix Undefined global 'vim'
lsp.configure('sumneko_lua', {
settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
}
}
}
})
local cmp = require('cmp')
local cmp_select = {behavior = cmp.SelectBehavior.Select}
local cmp_mappings = lsp.defaults.cmp_mappings({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
})
lsp.setup_nvim_cmp({
mapping = cmp_mappings
})
lsp.set_preferences({
suggest_lsp_servers = false,
sign_icons = {
error = 'E',
warn = 'W',
hint = 'H',
info = 'I'
}
})
lsp.on_attach(function(client, bufnr)
local opts = {buffer = bufnr, remap = false}
if client.name == "eslint" then
vim.cmd.LspStop('eslint')
return
end
vim.keymap.set("n", "<leader>gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "<leader>gh", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<leader>gcf", vim.lsp.buf.format, opts)
vim.keymap.set("n", "<leader>vws", vim.lsp.buf.workspace_symbol, opts)
vim.keymap.set("n", "<leader>gn", vim.diagnostic.open_float, opts)
vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts)
vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts)
vim.keymap.set("n", "<leader>ga", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<leader>vrr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "<leader>grn", vim.lsp.buf.rename, opts)
vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help, opts)
end)
lsp.setup()
vim.diagnostic.config({
virtual_text = true,
})
However if I remove eslint client, it works just fine.
Btw, I am noob, so I would be appreciate, if you consider this.
I want to keep all the other presets for the LSP when in a buffer that supports it. I Just want to ubind K
. Is my only option to set set_lsp_keymap
to false and rebind every keybinding?
It would be very helpful to have this as a top level configuration and not need to add mappings to override the select opts. Thanks!
Is it possible to make github.com/ray-x/lsp_signature.nvim this plugin work with Lsp-zero???
If no, can we add support for it?
This is my current lsp-zero packer config:
use({
"VonHeikemen/lsp-zero.nvim",
requires = {
-- lsp
{ "neovim/nvim-lspconfig" },
{ "williamboman/mason.nvim" },
{ "williamboman/mason-lspconfig.nvim" },
-- autocomplete
{ "hrsh7th/nvim-cmp" },
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/cmp-path" },
{ "saadparwaiz1/cmp_luasnip" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-nvim-lua" },
-- snippets
{ "L3MON4D3/LuaSnip" },
{ "rafamadriz/friendly-snippets" },
},
config = function()
require("lspconfig").ansiblels.setup({
settings = {
ansible = {
ansibleLint = {
arguments = "-x risky-shell-pipe,package-latest,meta-no-info,role-name,yaml[line-length],no-changed-when,fqcn-builtins,name[casing]",
},
},
},
})
end,
})
Without the require("lspconfig").ansiblels.setup({
block the diagnostics floating window works fine by pressing gl
, but once I have it active the LSP warnings are still displayed as icons, but I can't get the diagnostics floating window to show up by pressing gl
.
Do you please have a hint what I am doing wrong? It would be great if both would work at the same time, the LSP server config and the diagnostics floating window.
Hi, i am new to NeoVim and would like to know if it is possible to display diagnostic messages (in case of a warning or an error) upon hover. I have searched the question and didn't find any satisfactory answer.
Is this even possible with the nvim lsp or just the current buffer? Currently trying to use it for lua. Everything works, I can use gd to navigate to the definition in a separate buffer but can only find references within the current buffer, not project-wide. Thanks
Is it possible to append null-ls plugin?
It's very helpfull for diagnostic and formatting
Following the guidance on #53, I'm using lsp-compe
as the preset so I can setup some cmdline completions. However, using that preset, I can't seem to override the default sources. For instance if I set { name = "luasnip", keyword_length = 10, max_item_count = 5 }
, I see lots of LuaSnip suggestions after typing -
, in a lua file.
I've reproduced this with a minimal.lua file, below:
local test_dir = "/tmp/lsp_zero_test"
-- ignore default config and plugins
vim.opt.runtimepath:remove(vim.fn.expand("~/.config/nvim"))
vim.opt.packpath:remove(vim.fn.expand("~/.local/share/nvim/site"))
-- append test directory
vim.opt.runtimepath:append(vim.fn.expand(test_dir))
vim.opt.packpath:append(vim.fn.expand(test_dir))
-- install packer
local install_path = test_dir .. "/pack/packer/start/packer.nvim"
local install_plugins = false
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
vim.cmd("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
vim.cmd("packadd packer.nvim")
install_plugins = true
end
local packer = require("packer")
packer.init({
package_root = test_dir .. "/pack",
compile_path = test_dir .. "/plugin/packer_compiled.lua",
})
-- install plugins
packer.startup(function(use)
use("wbthomason/packer.nvim")
use({
"VonHeikemen/lsp-zero.nvim",
requires = {
-- LSP Support
{ "neovim/nvim-lspconfig" },
{ "williamboman/mason.nvim" },
{ "williamboman/mason-lspconfig.nvim" },
-- Autocompletion
{ "hrsh7th/nvim-cmp" },
{ "hrsh7th/cmp-buffer" },
{ "hrsh7th/cmp-path" },
{ "saadparwaiz1/cmp_luasnip" },
{ "hrsh7th/cmp-nvim-lsp" },
{ "hrsh7th/cmp-nvim-lua" },
-- Snippets
{ "L3MON4D3/LuaSnip" },
{ "rafamadriz/friendly-snippets" },
},
})
if install_plugins then packer.sync() end
end)
-- Setup LSP
local ok, lsp = pcall(require, "lsp-zero")
if not ok then return end
lsp.preset("lsp-compe")
lsp.ensure_installed({
"sumneko_lua",
})
lsp.nvim_workspace()
lsp.setup()
vim.opt.completeopt = { "menu", "menuone", "noselect" }
local cmp = require("cmp")
local cmp_config = lsp.defaults.cmp_config({
sources = {
{ name = "path" },
{ name = "nvim_lsp", keyword_length = 10, max_item_count = 5 },
{ name = "buffer", keyword_length = 3, max_item_count = 5 },
{ name = "luasnip", keyword_length = 10, max_item_count = 5 },
{ name = "nvim_lua" },
{ name = "nvim_lsp_signature_help" },
},
})
cmp.setup(cmp_config)
then running Neovim with nvim --clean -u minimal.lua minimal.lua
It appears the developer of nvim-lsp-installer, William Boman is no longer going to maintain nvim-lsp-installer, instead, he's developing mason.
More details can be found here
Just putting it out here in case @VonHeikemen didn't see the post on Reddit. Just wondering if lsp-zero will switch or not, would like to help, but setting up LSP is a pain haha.
Hello,
I like to keep the default vim behavior regarding <Tab>, <C-n> & <C-p>
, but it seems <Tab>
is set to cycle through the list even when I setup lsp_zero with this:
lsp.set_preferences({
suggest_lsp_servers = true,
setup_servers_on_start = true,
set_lsp_keymaps = false,
configure_diagnostics = true,
cmp_capabilities = true,
manage_nvim_cmp = true,
sign_icons = {
error = '✘',
warn = '▲',
hint = '⚑',
info = ''
}
})
Am I missing something ? I can fix by overwriting my keybinding after I setup lsp_zero but I dont believe it is the expected behavior.
Tried to reset the keymap with :unmap <Tab>
but it does not work.
Thanks!
As seen here. However, I believe this is further complicated by the fact that you can't just run :MasonInstall
without an argument for a particular server.
This may be something that has to wait until it's available upstream to be able to do something like :MasonInstall lsp
or something to have it suggest the correct server for the current filetype, since calculating that is WAY too out of scope for this plugin. Maybe just having it split out some text that says to run the :Mason
UI yourself or something so people aren't too confused?
Thank you for this plugin! It saved me hours of frustration after starting a Neovim config from scratch this week.
Error detected while processing :source (no file):
E5108: Error executing lua [string ":lua"]:1: module 'lsp-zero' not found:
no field package.preload['lsp-zero']
no file './lsp-zero.lua'
no file '/usr/share/luajit-2.1.0-beta3/lsp-zero.lua'
no file '/usr/local/share/lua/5.1/lsp-zero.lua'
no file '/usr/local/share/lua/5.1/lsp-zero/init.lua'
no file '/usr/share/lua/5.1/lsp-zero.lua'
no file '/usr/share/lua/5.1/lsp-zero/init.lua'
no file './lsp-zero.so'
no file '/usr/local/lib/lua/5.1/lsp-zero.so'
no file '/usr/lib64/lua/5.1/lsp-zero.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
[string ":lua"]:1: in main chunk
am using vimPlug and nvim-lspconfig is working fine when i run :LspInstall
Not sure if lsp-zero is causing this, but when invoking vim.lsp.buf.rename
, sumneko_lua (I checkd that it is attached to the buffer) prints "Language server couldn't provide rename result".
Currently it shows in a pop up window , now can I have it automatically show on the line?
I've installed lsp-zero using the packer instructions, and I've got this in after/plugin/lsp.lua
:
local lsp = require('lsp-zero')
lsp.preset('recommended')
lsp.setup()
lsp.ensure_installed({
'tsserver',
'eslint',
'sumneko_lua',
'rust_analyzer',
})
lsp.set_preferences({
suggest_lsp_servers = false,
sign_icons = {
error = 'E',
warn = 'W',
hint = 'H',
info = 'I'
}
})
vim.diagnostic.config({
virtual_text = true,
})
lsp.setup()
But when I open a c# file, I see this:
Please let me know if there's anything else I can provide to help solve this.
I'm just a dufus, but I'm unable to get the copilot suggestions and the suggestions from this plugin to play nice with each other...
I'm trying to use lsp-zero AND the following plugins to make this work.
Literally any help on this would be amazing... I'm new to neovim and would love to get the copilot suggestions working with how lsp-zero implements them... :)
I'm not sure which plugin to attribute this behavior to, but hoping to get some guidance.
I'm working in ruby, and go to write an if/else statement, but I don't use the snippet. I can do the if
fine like this, but as soon as I go to do the else
, the if else
snippet starts matching. If I press enter, then that snippet is triggered, and it ends up creating a second if statement instead of let
It seems like typing else
should only match snippets that match else
, rather than ones that end in it.
My configuration:
local lsp = require("lsp-zero")
local lspkind = require("lspkind")
lsp.preset("recommended")
lsp.nvim_workspace()
lsp.setup_nvim_cmp({
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text",
menu = {
buffer = "[Buffer]",
nvim_lsp = "[LSP]",
luasnip = "[LuaSnip]",
nvim_lua = "[Lua]",
latex_symbols = "[Latex]",
},
}),
},
sources = {
{ name = "nvim_lsp_signature_help" },
{ name = "path" },
{ name = "fish" },
{ name = "nvim_lsp", keyword_length = 3 },
{ name = "buffer", keyword_length = 3 },
{ name = "luasnip", keyword_length = 2 },
},
})
lsp.configure("sumneko_lua", {
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { "vim" },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
},
},
})
lsp.setup()
Hello,
Your feature for suggesting lsp servers is great. Is there any chance you might turn it into its own plugin? Or do you know of any plugins that do it already?
Is there a way to pass the { 'completion.autocomplete' }
option through to cmp
? I'm trying to get a debounce on my completion, which led me to hrsh7th/nvim-cmp#598, which requires a config param (autocomplete
) be passed in to cmp
before cmp.setup()
is called. Looks like cmp
documents a similar approach to a problem here.
I see your documentation of setup_nvim_cmp but I'm not clearly understanding from the docs whether the completion
list will be passed in, and in my attempts to make it work, it is not working.
P.S. Thank you for making this tool! I'm fresh in the nvim world from vim and this tool has really eased my transition.
Unmapping <CR> from cmp mapping has no effect. The default function of <CR> is still performed. I used this link to unmap <CR> from cmp_mapping.
local fresh_install = function()
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end
local packer_bootstrap = fresh_install()
local packer = require('packer')
packer.startup(function(use)
use {
'VonHeikemen/lsp-zero.nvim',
requires = {
-- LSP Support
{'neovim/nvim-lspconfig'},
{'williamboman/mason.nvim'},
{'williamboman/mason-lspconfig.nvim'},
-- Autocompletion
{'hrsh7th/nvim-cmp'},
{'hrsh7th/cmp-buffer'},
{'hrsh7th/cmp-path'},
{'saadparwaiz1/cmp_luasnip'},
{'hrsh7th/cmp-nvim-lsp'},
{'hrsh7th/cmp-nvim-lua'},
-- Snippets
{'L3MON4D3/LuaSnip'},
{'rafamadriz/friendly-snippets'},
}
}
if packer_bootstrap then
require('packer').sync()
end
end)
local ok_lsp, lsp = pcall(require, 'lsp-zero')
if not ok_lsp then
vim.notify('lsp-zero not found', vim.log.levels.ERROR)
return
end
lsp.preset('recommended')
lsp.ensure_installed({
'clangd',
'sumneko_lua',
'cmake',
'pyright',
})
local ok_cmp, cmp = pcall(require, 'cmp')
if not ok_cmp then
vim.notify('cmp not found', vim.log.levels.ERROR)
return
end
local cmp_select = {behavior = cmp.SelectBehavior.Select}
local cmp_mapping = lsp.defaults.cmp_mappings({
['<C-m>'] = cmp.mapping.confirm({ select = true }),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
})
cmp_mapping['<CR>'] = nil
lsp.setup_nvim_cmp({
mapping = cmp_mapping,
})
lsp.on_attach(function(client, bufnr)
local opts = {buffer = bufnr, remap = false}
if client.name == "eslint" then
vim.cmd.LspStop('eslint')
return
end
-- print offset_encoding
print(client.offset_encoding)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<leader>ws", vim.lsp.buf.workspace_symbol, opts)
vim.keymap.set("n", "<leader>vd", vim.diagnostic.open_float, opts)
vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts)
vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts)
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<leader>rr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help, opts)
end)
lsp.setup()
vim.diagnostic.config({
virtual_text = true,
})
ls
Open the lua file. Goto to end of ls in insert mode. Trigger autocomplete via . It would show options loremSent and loadString.
Pressing should ignore autocomplete and insert a new line.
Pressing complete the autocomplete, changes ls to Lorem ipsum ....
Am I missing some other configuration to set in order to unmap ?
Hi,
I'm trying to figure out a way to have lsp-zero with recommended settings (so with setup_servers_on_start
set to true
) and rust-tools
to co-exist in the same config. The problem I'm having seems to be that lsp-zero automatically configures rust_analyzer
and that somehow, this interferes with rust-tools
's configuration. I've tried putting require("rust-tools").setup {}
before or after lsp.setup()
but it does not seem to work. If I set setup_servers_on_start
to false
, then rust-tools
works, but then other LSPs are not configured...
Any suggestions? Maybe adding a way to specify a list of LSP that would be excluded from automatic configuration. Then, for these LSP servers, you would have to manually configure them (or let rust-tools
do it in my case).
Thanks for a very cool plugin BTW!
EDIT: typos
I have just installed with vim-plug, using "recommended" on Neviom 0.7. After being asked if I want to install a vim LSP when opening my config, I selected yes. When I relaunch and open a vim file I get a console message:
Spawning language server with cmd: `vim-language-server` failed. The language server is either not installed, missing from PATH, or not executable.
Isn't this plugin meant to manage all of this? Not sure how to fix this.
Hello,
I am receiving a error after installing lsp-zero and configuring the lsp.lua file with your minimum required config. The issue is from the lsp.setup()
line inside lsp.lua. Any information will help thank you.
lsp.lua entire file contents (location: ~/.config/nvim/after/plugin/lsp.lua)
local lsp = require('lsp-zero')
lsp.preset('recommended')
lsp.setup()
Full ERROR code:
E5108: Error executing lua vim/_meta.lua:597: E474: Invalid argument
stack traceback:
[C]: in function 'nvim_set_option_value'
vim/_meta.lua:597: in function 'append'
...cker/start/lsp-zero.nvim/lua/lsp-zero/nvim-cmp-setup.lua:152: in function 'call_setup'
...im/site/pack/packer/start/lsp-zero.nvim/lua/lsp-zero.lua:32: in function 'setup'
[string ":source (no file)"]:5: in main chunk
This is the function in question inside the file _meta.lua on line 597
a.nvim_set_option_value(self._name, value, {scope = scope})
all other code is from the lsp-zero install via packer on ubuntu linux
neovim version:
NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.