1
Fork 0

LSP stuff

This commit is contained in:
Hadeed 2024-08-21 11:25:00 +05:00
parent c81d4c0bd8
commit 24103db8b6
2 changed files with 14 additions and 6 deletions

View file

@ -1,14 +1,15 @@
return { return {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
dependencies = { dependencies = {
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua", "hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path", "hrsh7th/cmp-path",
"L3MON4D3/LuaSnip" "L3MON4D3/LuaSnip"
}, },
config = function() config = function()
local cmp = require("cmp") local cmp = require("cmp")
vim.opt.completeopt = {"menu", "menuone", "noinsert"}
cmp.setup { cmp.setup {
snippet = { snippet = {
@ -17,6 +18,7 @@ return {
end end
}, },
mapping = cmp.mapping.preset.insert { mapping = cmp.mapping.preset.insert {
['<C-Space>'] = cmp.mapping.complete(),
["<C-Y>"] = function(fallback) ["<C-Y>"] = function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.confirm { select=true } cmp.confirm { select=true }

View file

@ -6,13 +6,19 @@ return {
config = function() config = function()
local lspconfig = require("lspconfig") 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 { lspconfig.emmet_ls.setup {
capabilities = emmet_capabilities, capabilities = snippet_capabilities
filetypes = { "html", "javascriptreact", "typescriptreact" } }
lspconfig.tailwindcss.setup {
capabilities = snippet_capabilities
}
lspconfig.cssls.setup {
capabilities = snippet_capabilities
} }
vim.api.nvim_create_autocmd("LspAttach", { vim.api.nvim_create_autocmd("LspAttach", {