Skip to content

Commit

Permalink
feat: tweak lspconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
tokuda109 committed Aug 20, 2023
1 parent fccdcd3 commit 66b4d81
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions nvim/lua/plugins/_lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ if not cmp_status_ok then
return
end

local cmpnvimlsp_status_ok, cmpnvimlsp = pcall(require, 'cmp_nvim_lsp')
if not cmpnvimlsp_status_ok then
return
end

local on_attach = function(_, bufnr)
local opt = { noremap = true, silent = true }
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opt)
Expand Down Expand Up @@ -51,6 +56,23 @@ mason_lspconfig.setup_handlers({
end
})

local capabilities = vim.lsp.protocol.make_client_capabilities()
local cmp_capabilities = cmpnvimlsp.default_capabilities(capabilities)

lspconfig.cssls.setup { capabilities = cmp_capabilities }
lspconfig.gopls.setup { capabilities = cmp_capabilities }
lspconfig.graphql.setup { capabilities = cmp_capabilities }
lspconfig.tsserver.setup { capabilities = cmp_capabilities }
lspconfig.volar.setup {
capabilities = cmp_capabilities,
filetypes = {
'json',
'javascript',
'typescript',
'vue',
}
}

lspconfig.lua_ls.setup({
settings = {
Lua = {
Expand Down
3 changes: 2 additions & 1 deletion nvim/lua/plugins/_telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ local opt = { noremap = true, silent = true }
telescope.setup({
defaults = {
file_ignore_patterns = {
'node_modules'
'node_modules',
'package-lock.json',
},
mappings = {
i = {},
Expand Down

0 comments on commit 66b4d81

Please sign in to comment.