just moved to lsp-zero. Finally lsp is actually working. But I lost completion at the command-prompt. By enabling my old nvim-cmp.setup(), I got it back. But does that have a cost? #53
-
As the (reddit-style, long title lol) states, by putting this in my config I got completion of commands back:
Could this be screwing with the lsp-zero setup in any way, though? also, a bonus question, I was super impressed by the linter-suggestions in my R-scripts. However, the linter wants me to use double quotes as the standard in my code. I don't want to do that. Is there a way to remove that type of suggestion? I guess this is the downside of an auto-config such as lsp-zero: I actually got it working, very easily, but the options to do stuff 'under the hood' gets obscured somewhat. Or how would I come about changing this, for example? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I think nvim-cmp will merge the old config with the new config, so the config from lsp-zero should be merge with yours. But I'm not sure. Since you have a lot of customizations I would recommend changing the preset to local lsp = require('lsp-zero')
lsp.preset('lsp-compe')
lsp.setup()
vim.opt.completeopt = {'menu', 'menuone', 'noselect'}
local cmp = require('cmp')
local cmp_config = lsp.defaults.cmp_config({
---
-- Add your nvim-cmp config here
---
})
cmp.setup(cmp_config)
--- more code .....
You'll have to check the documentation for the lsp server you are using, and then modify the config for that server using the local lsp = require('lsp-zero')
lsp.preset('lsp-compe')
lsp.configure('name-of-the-server', {
---
-- Server configuration goes here
---
})
lsp.setup() The second argument in |
Beta Was this translation helpful? Give feedback.
-
For anyone coming to this, most likely after ThePrimeagen's video, my completion config is: local lsp = require('lsp-zero')
lsp.preset('lsp-compe')
lsp.setup()
local cmp = require("cmp")
local cmp_config = lsp.defaults.cmp_config({
formatting = {
format = function(...) return require("lspkind").cmp_format({ mode = "symbol_text" })(...) end,
},
sources = {
{ name = "luasnip", priority = 100 },
{ name = "nvim_lsp", priority = 90 },
{ name = "nvim_lsp_signature_help" },
{ name = "nvim_lua", priority = 90 },
{ name = "copilot", priority = 80 },
{ name = "path", priority = 5 },
},
})
cmp.setup(cmp_config)
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path" },
}, {
{
name = "cmdline",
option = {
ignore_cmds = { "Man", "!" },
},
},
}),
})
cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer" },
},
}) |
Beta Was this translation helpful? Give feedback.
I think nvim-cmp will merge the old config with the new config, so the config from lsp-zero should be merge with yours. But I'm not sure.
Since you have a lot of customizations I would recommend changing the preset to
lsp-compe
and use.defaults.cmp_config
to extend the defaults.