Open stefanwatt opened 1 year ago
Minimal init.lua:
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
require("lazy").setup({
{
'williamboman/mason.nvim',
dependencies = {
-- LSP Support
{ 'neovim/nvim-lspconfig' },
{ 'williamboman/mason-lspconfig.nvim' },
}
},
{
'hrsh7th/nvim-cmp',
dependencies = {
{ 'hrsh7th/cmp-buffer' },
{ 'saadparwaiz1/cmp_luasnip' },
{ 'hrsh7th/cmp-nvim-lsp' },
{ 'L3MON4D3/LuaSnip' },
},
config = function()
local cmp = require('cmp')
local luasnip = require('luasnip')
cmp.setup({
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' }
}),
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
})
end
}
})
require('mason').setup()
local servers = {
'svelte',
'tsserver',
}
local mason_lspconfig = require('mason-lspconfig')
mason_lspconfig.setup({
ensure_installed = servers,
automatic_installation = true,
})
local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities()
local lspconfig = require('lspconfig')
for k, server in pairs(servers) do
lspconfig[server].setup({
on_attach = function()
end,
capabilities = lsp_capabilities,
})
end
repo to reproduce: https://github.com/stefanwatt/minimal-repro-cmp-nvim-lsp-56
@stefanwatt Did you find solution?
Any update on this? Same issue, is very annoying
I think the items are cached...
It seems cached by LSP server side. Because it is fixed by LSP server restart. Please check it is only reproduced with nvim-cmp.
Hi everybody,
I wonder if this is related to something I've been dealing with. I added nvim_lsp
as a source to cmp.setup
but got
# unknown source names
- otter
- nvim_lsp
from :CmpStatus
. I noticed (using the above methodology) eventually that these unknown source names would disappear once I wrote the the loaded file. I assume that such behavior is not desired, but I do not know for sure.
I don't think the languages matter and it's probably a general issue, but describing the scenario probably helps you understand.
translate(key:TranslationKey
)) from a Svelte file.TranslationKey
being defined like so:type TranslationKey = 'foo' | 'bar'
translate('b
bar
TranslationKey = 'foo' | 'bar'| 'baz'
translate('b
'bar'
and not'baz'
:LspRestart svelte
translate('b
'bar'
and'baz'
I get the same behavior importing the translation file from an Astro component (*.astro). So it's not a problem with the Svelte LS.