configured lsp plugins
This commit is contained in:
47
lua/config/lsp.lua
Normal file
47
lua/config/lsp.lua
Normal file
@@ -0,0 +1,47 @@
|
||||
-- lsp config
|
||||
require('lspconfig')
|
||||
local lsp_servers = {
|
||||
'clangd',
|
||||
'pyright',
|
||||
'lua_ls',
|
||||
}
|
||||
for _, server in ipairs(lsp_servers) do
|
||||
local config = {}
|
||||
|
||||
-- Special settings for Lua
|
||||
if server == 'lua_ls' then
|
||||
config.settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
-- Tell the language server that 'vim' is a global
|
||||
globals = { 'vim' },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
checkThirdParty = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
-- Apply the config and enable
|
||||
vim.lsp.config(server, config)
|
||||
vim.lsp.enable(server)
|
||||
end
|
||||
-- highlight error messages
|
||||
vim.diagnostic.config({
|
||||
virtual_text = {
|
||||
prefix = '■',
|
||||
spacing = 4,
|
||||
},
|
||||
-- Show signs in the gutter (left side)
|
||||
signs = true,
|
||||
-- Underline the actual code that has the error
|
||||
underline = true,
|
||||
-- Don't update diagnostics while typing (keeps it less distracting)
|
||||
update_in_insert = true,
|
||||
-- Better looking border for float windows
|
||||
float = { border = "rounded" },
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user