-
Notifications
You must be signed in to change notification settings - Fork 43
/
nvim-lspconfig.lua
78 lines (70 loc) · 2.31 KB
/
nvim-lspconfig.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
-- LSP Support
return {
-- LSP Configuration
-- https://github.com/neovim/nvim-lspconfig
'neovim/nvim-lspconfig',
event = 'VeryLazy',
dependencies = {
-- LSP Management
-- https://github.com/williamboman/mason.nvim
{ 'williamboman/mason.nvim' },
-- https://github.com/williamboman/mason-lspconfig.nvim
{ 'williamboman/mason-lspconfig.nvim' },
-- Useful status updates for LSP
-- https://github.com/j-hui/fidget.nvim
{ 'j-hui/fidget.nvim', opts = {} },
-- Additional lua configuration, makes nvim stuff amazing!
-- https://github.com/folke/neodev.nvim
{ 'folke/neodev.nvim', opts = {} },
},
config = function ()
require('mason').setup()
require('mason-lspconfig').setup({
-- Install these LSPs automatically
ensure_installed = {
-- 'bashls', -- requires npm to be installed
-- 'cssls', -- requires npm to be installed
-- 'html', -- requires npm to be installed
'lua_ls',
-- 'jsonls', -- requires npm to be installed
'lemminx',
'marksman',
'quick_lint_js',
-- 'tsserver', -- requires npm to be installed
-- 'yamlls', -- requires npm to be installed
}
})
local lspconfig = require('lspconfig')
local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities()
local lsp_attach = function(client, bufnr)
-- Create your keybindings here...
end
-- Call setup on each LSP server
require('mason-lspconfig').setup_handlers({
function(server_name)
lspconfig[server_name].setup({
on_attach = lsp_attach,
capabilities = lsp_capabilities,
})
end
})
-- Lua LSP settings
lspconfig.lua_ls.setup {
settings = {
Lua = {
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = {'vim'},
},
},
},
}
-- Globally configure all LSP floating preview popups (like hover, signature help, etc)
local open_floating_preview = vim.lsp.util.open_floating_preview
function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...)
opts = opts or {}
opts.border = opts.border or "rounded" -- Set border to rounded
return open_floating_preview(contents, syntax, opts, ...)
end
end
}