Closed BigfootN closed 2 months ago
Hello,
I'm sorry but I can't find any better suited title. I can't see any suitable reason for not working.
Here is my configuration (I'm using lazy.nvim):
lazy.nvim
-- lsp config { "neovim/nvim-lspconfig", dependencies = { { "hrsh7th/cmp-nvim-lsp", lazy = false, opts = { enabled = true, completion = { autocomplete = true }, snippet = { expand = function(args) vim.snippet.expand(args.body) end }, sources = { name = 'nvim_lsp' }} }, { "hrsh7th/nvim-cmp", lazy = false }, }, lazy = false, opts = { -- diagnostics diagnostics = { signs = true, update_in_insert = true, underline = true, virtual_text = true, severity_sort = false, }, signs = { Error = "", Warn = "", Info = "", Hint = "" }, -- servers servers = { -- rust lsp rust_analyzer = { settings = { ['rust-analyzer'] = { cargo = { allTargets = true }, cachePriming = { enable = true, numThreads = 16 }, assist = { emitMustUse = true }, diagnostics = { enable = true } } } }, -- lua ls lua_ls = { runtime = { version = "LuaJIT", }, completion = { autoRequire = true, callSnipet = "Replace", displayContext = 0, enable = true, keywordSnippet = true, postfix = "@", showParams = true }, hint = { arrayIndex = "Enable", enable = true }, semantic = { keyword = true } } } }, config = function(_, opts) local client_capabilities = vim.lsp.protocol.make_client_capabilities() local cmp_nvim_lsp = require("cmp_nvim_lsp") local capabilities = cmp_nvim_lsp.default_capabilities() local lspconfig = require("lspconfig") for server_name, settings in pairs(opts.servers) do settings.capabilities = capabilities lspconfig[server_name].setup(settings) end vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) local client = vim.lsp.get_client_by_id(args.data.client_id) if client.supports_method("textDocument/inlayHint") then vim.lsp.inlay_hint.enable(true) end end }); vim.diagnostic.config(opts.diagnostics) for type, icon in pairs(opts.signs) do local hl = "DiagnosticSign" .. type vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) end end },
Everything else works. I can clearly see diagnostics. But no autocompletion seems to be working.
Thank you very much in advance for any help.
Sorry I figured it out.
The sources needed require("cmp").sources(...).
require("cmp").sources(...)
Hello,
I'm sorry but I can't find any better suited title. I can't see any suitable reason for not working.
Here is my configuration (I'm using
lazy.nvim
):Everything else works. I can clearly see diagnostics. But no autocompletion seems to be working.
Thank you very much in advance for any help.