From 24103db8b67fe6c195ff9e47b9692cf7d266369b Mon Sep 17 00:00:00 2001 From: Hadeed Ahmad Date: Wed, 21 Aug 2024 11:25:00 +0500 Subject: [PATCH] LSP stuff --- nvim/lua/plugins/completion.lua | 4 +++- nvim/lua/plugins/lsp.lua | 16 +++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/nvim/lua/plugins/completion.lua b/nvim/lua/plugins/completion.lua index bb41ba4..6d8759b 100644 --- a/nvim/lua/plugins/completion.lua +++ b/nvim/lua/plugins/completion.lua @@ -1,14 +1,15 @@ return { "hrsh7th/nvim-cmp", dependencies = { - "hrsh7th/cmp-buffer", "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lua", + "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", "L3MON4D3/LuaSnip" }, config = function() local cmp = require("cmp") + vim.opt.completeopt = {"menu", "menuone", "noinsert"} cmp.setup { snippet = { @@ -17,6 +18,7 @@ return { end }, mapping = cmp.mapping.preset.insert { + [''] = cmp.mapping.complete(), [""] = function(fallback) if cmp.visible() then cmp.confirm { select=true } diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index 692c208..eb090a7 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -6,13 +6,19 @@ return { config = function() local lspconfig = require("lspconfig") - lspconfig.clangd.setup {} + local snippet_capabilities = vim.lsp.protocol.make_client_capabilities() + snippet_capabilities.textDocument.completion.completionItem.snippetSupport = true - local emmet_capabilities = vim.lsp.protocol.make_client_capabilities() - emmet_capabilities.textDocument.completion.completionItem.snippetSupport = true lspconfig.emmet_ls.setup { - capabilities = emmet_capabilities, - filetypes = { "html", "javascriptreact", "typescriptreact" } + capabilities = snippet_capabilities + } + + lspconfig.tailwindcss.setup { + capabilities = snippet_capabilities + } + + lspconfig.cssls.setup { + capabilities = snippet_capabilities } vim.api.nvim_create_autocmd("LspAttach", {