1
Fork 0
satellite/home/features/neovim/config/lua/my/plugins/lspconfig.lua

138 lines
3.1 KiB
Lua
Raw Normal View History

2023-12-21 16:21:14 +01:00
local runtime = require("my.tempest")
2023-01-10 02:38:06 +01:00
local lspconfig = {
"neovim/nvim-lspconfig",
event = "VeryLazy",
2023-01-10 02:38:06 +01:00
dependencies = {
2024-01-01 21:24:04 +01:00
"neoconf",
2023-01-10 02:38:06 +01:00
{
"folke/neodev.nvim",
config = true,
},
},
2023-12-21 16:21:14 +01:00
cond = runtime.blacklist("vscode"),
2023-01-10 02:38:06 +01:00
}
local M = lspconfig
2023-01-10 02:38:06 +01:00
-- {{{ General server config
---@type lspconfig.options
2023-09-22 20:08:11 +02:00
---@diagnostic disable-next-line: missing-fields
2023-01-10 02:38:06 +01:00
local servers = {
-- {{{ Typescript
2023-09-22 20:08:11 +02:00
---@diagnostic disable-next-line: missing-fields
2023-01-10 02:38:06 +01:00
tsserver = {
on_attach = function(client, bufnr)
-- We handle formatting using null-ls and prettierd
client.server_capabilities.documentFormattingProvider = false
M.on_attach(client, bufnr)
end,
},
-- }}}
-- {{{ Purescript
purescriptls = {
settings = {
2023-09-22 20:08:11 +02:00
---@diagnostic disable-next-line: missing-fields
2023-01-10 02:38:06 +01:00
purescript = {
censorWarnings = { "UnusedName", "ShadowedName", "UserDefinedWarning" },
formatter = "purs-tidy",
},
},
},
-- }}}
-- {{{ Lua
2023-03-30 02:54:57 +02:00
lua_ls = {
2023-01-10 02:38:06 +01:00
cmd = {
"lua-language-server",
"--logpath=/home/adrielus/.local/share/lua-language-server/log",
},
2023-03-30 02:54:57 +02:00
settings = {
2023-09-22 20:08:11 +02:00
---@diagnostic disable-next-line: missing-fields
2023-03-30 02:54:57 +02:00
Lua = {
2023-12-04 06:25:00 +01:00
---@diagnostic disable-next-line: missing-fields
format = {
2023-12-07 22:35:57 +01:00
enable = true,
2023-12-04 06:25:00 +01:00
},
2023-03-30 02:54:57 +02:00
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
},
},
2023-01-10 02:38:06 +01:00
},
-- }}}
-- {{{ Latex
texlab = {
settings = {
texlab = {
build = {
args = {
-- Here by default:
"-pdf",
"-interaction=nonstopmode",
"-synctex=1",
"%f",
-- Required for syntax highlighting inside the generated pdf aparently
"-shell-escape",
},
executable = "latexmk",
forwardSearchAfter = true,
onSave = true,
},
chktex = {
onOpenAndSave = true,
onEdit = true,
},
2023-01-10 02:38:06 +01:00
},
},
},
-- }}}
2023-06-15 20:08:20 +02:00
-- {{{ Nix
2023-01-10 02:38:06 +01:00
rnix = {},
2024-01-01 21:24:04 +01:00
-- nil_ls = {},
2023-06-15 20:08:20 +02:00
nixd = {},
-- }}}
2023-09-22 20:08:11 +02:00
---@diagnostic disable-next-line: missing-fields
2023-01-10 02:38:06 +01:00
cssls = {},
2023-09-22 20:08:11 +02:00
---@diagnostic disable-next-line: missing-fields
2023-01-10 02:38:06 +01:00
jsonls = {},
dhall_lsp_server = {},
typst_lsp = {},
2023-09-22 20:08:11 +02:00
---@diagnostic disable-next-line: missing-fields
2023-08-19 21:13:34 +02:00
elmls = {},
2023-06-15 20:08:20 +02:00
-- {{{ Inactive
2023-03-30 02:54:57 +02:00
-- pylsp = {},
-- pyright = {},
2023-06-15 20:08:20 +02:00
-- }}}
2023-01-10 02:38:06 +01:00
}
-- }}}
-- {{{ Capabilities
M.capabilities = function()
local c = require("cmp_nvim_lsp").default_capabilities()
-- Add folding capabilities
2023-06-15 20:08:20 +02:00
c.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true,
}
2023-01-10 02:38:06 +01:00
return c
end
-- }}}
-- {{{ Main config function
function lspconfig.config()
vim.lsp.handlers["textDocument/hover"] =
2023-12-07 22:35:57 +01:00
vim.lsp.with(vim.lsp.handlers.hover, { border = "single" })
vim.lsp.handlers["textDocument/signatureHelp"] =
2023-12-07 22:35:57 +01:00
vim.lsp.with(vim.lsp.handlers.signature_help, { border = "single" })
-- }}}
2023-01-10 02:38:06 +01:00
local capabilities = M.capabilities()
for lsp, details in pairs(servers) do
details.capabilities = capabilities
require("lspconfig")[lsp].setup(details)
2023-01-10 02:38:06 +01:00
end
2024-01-01 21:24:04 +01:00
end
2023-01-10 02:38:06 +01:00
--}}}
return M