2022-10-06 04:44:41 +00:00
|
|
|
local on_attach = require('plugins.lsp.on_attach')
|
|
|
|
-- Mappings.
|
|
|
|
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
|
|
|
local opts = { noremap=true, silent=true }
|
|
|
|
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
|
|
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
|
|
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
|
|
|
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
|
|
|
|
|
|
|
local lsp_flags = {
|
|
|
|
-- This is the default in Nvim 0.7+
|
|
|
|
debounce_text_changes = 150,
|
|
|
|
}
|
|
|
|
require('lspconfig')['pyright'].setup({
|
|
|
|
on_attach = on_attach,
|
|
|
|
flags = lsp_flags,
|
|
|
|
})
|
2023-02-16 05:32:25 +00:00
|
|
|
-- Setup by typescript.nvim automatically
|
|
|
|
-- require('lspconfig')['tsserver'].setup({
|
|
|
|
-- on_attach = on_attach,
|
|
|
|
-- flags = lsp_flags,
|
|
|
|
-- })
|
2022-10-06 04:44:41 +00:00
|
|
|
require('lspconfig')['jsonls'].setup({
|
|
|
|
on_attach = on_attach,
|
|
|
|
flags = lsp_flags,
|
|
|
|
})
|
|
|
|
require('lspconfig')['eslint'].setup({
|
|
|
|
on_attach = on_attach,
|
|
|
|
flags = lsp_flags,
|
2023-01-07 02:05:38 +00:00
|
|
|
root_dir = require('lspconfig').util.find_git_ancestor,
|
2022-10-06 04:44:41 +00:00
|
|
|
})
|
|
|
|
require('lspconfig')['html'].setup({
|
|
|
|
on_attach = on_attach,
|
|
|
|
flags = lsp_flags,
|
|
|
|
})
|
|
|
|
require('lspconfig')['cssls'].setup({
|
|
|
|
on_attach = on_attach,
|
|
|
|
flags = lsp_flags,
|
|
|
|
})
|
|
|
|
-- Setup by rust-tools automatically
|
|
|
|
-- require('lspconfig')['rust_analyzer'].setup({
|
|
|
|
-- on_attach = on_attach,
|
|
|
|
-- flags = lsp_flags,
|
|
|
|
-- -- Server-specific settings...
|
|
|
|
-- settings = {
|
|
|
|
-- ['rust-analyzer'] = {}
|
|
|
|
-- }
|
|
|
|
-- })
|
2023-02-16 05:32:39 +00:00
|
|
|
require('lspconfig')['lua_ls'].setup({
|
2022-10-06 04:44:41 +00:00
|
|
|
on_attach = on_attach,
|
|
|
|
flags = lsp_flags,
|
|
|
|
settings = {
|
|
|
|
Lua = {
|
2023-01-31 06:35:31 +00:00
|
|
|
completion = {
|
|
|
|
callSnippet = "Replace"
|
|
|
|
},
|
2022-10-06 04:44:41 +00:00
|
|
|
runtime = {
|
|
|
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
|
|
|
version = 'LuaJIT',
|
|
|
|
},
|
|
|
|
diagnostics = {
|
|
|
|
-- Get the language server to recognize the `vim` global
|
|
|
|
globals = { 'vim' },
|
|
|
|
},
|
|
|
|
workspace = {
|
|
|
|
-- Make the server aware of Neovim runtime files
|
|
|
|
library = vim.api.nvim_get_runtime_file('', true),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
require('lspconfig')['bashls'].setup({
|
|
|
|
on_attach = on_attach,
|
|
|
|
flags = lsp_flags,
|
|
|
|
})
|
|
|
|
require('lspconfig')['marksman'].setup({
|
|
|
|
on_attach = on_attach,
|
|
|
|
flags = lsp_flags,
|
|
|
|
})
|
|
|
|
require('lspconfig')['sqls'].setup({
|
2023-01-07 02:05:38 +00:00
|
|
|
on_attach = function(client, bufn)
|
2023-01-31 18:42:43 +00:00
|
|
|
on_attach(client, bufn)
|
2023-01-07 02:05:38 +00:00
|
|
|
require('sqls').on_attach(client, bufn)
|
|
|
|
end,
|
2022-10-06 04:44:41 +00:00
|
|
|
flags = lsp_flags,
|
|
|
|
})
|
|
|
|
require('lspconfig')['taplo'].setup({
|
|
|
|
on_attach = on_attach,
|
|
|
|
flags = lsp_flags,
|
|
|
|
})
|
2022-11-30 19:26:42 +00:00
|
|
|
require('lspconfig')['zls'].setup({
|
|
|
|
on_attach = on_attach,
|
|
|
|
flags = lsp_flags,
|
|
|
|
})
|