2024-03-09 16:57:38 +01:00
|
|
|
---@diagnostic disable: missing-fields
|
|
|
|
local M = {}
|
2023-01-10 02:38:06 +01:00
|
|
|
|
2024-02-24 01:53:32 +01:00
|
|
|
-- {{{ Capabilities
|
|
|
|
M.capabilities = function()
|
|
|
|
local c = require("cmp_nvim_lsp").default_capabilities()
|
2024-02-28 07:16:21 +01:00
|
|
|
|
2024-02-24 01:53:32 +01:00
|
|
|
-- Add folding capabilities
|
|
|
|
c.textDocument.foldingRange = {
|
|
|
|
dynamicRegistration = false,
|
|
|
|
lineFoldingOnly = true,
|
|
|
|
}
|
|
|
|
|
|
|
|
return c
|
|
|
|
end
|
|
|
|
-- }}}
|
|
|
|
-- {{{ Main config function
|
|
|
|
function M.config()
|
|
|
|
local lspconfig = require("lspconfig")
|
2023-01-10 02:38:06 +01:00
|
|
|
|
2024-02-24 01:53:32 +01:00
|
|
|
-- {{{ General server config
|
|
|
|
---@type lspconfig.options
|
|
|
|
local servers = {
|
|
|
|
-- {{{ Typescript
|
|
|
|
tsserver = {
|
|
|
|
on_attach = function(client)
|
|
|
|
-- We handle formatting using null-ls and prettierd
|
|
|
|
client.server_capabilities.documentFormattingProvider = false
|
|
|
|
end,
|
2023-01-10 02:38:06 +01:00
|
|
|
},
|
2024-02-24 01:53:32 +01:00
|
|
|
-- }}}
|
|
|
|
-- {{{ Purescript
|
|
|
|
purescriptls = {
|
|
|
|
root_dir = lspconfig.util.root_pattern("spago.yaml"),
|
|
|
|
settings = {
|
|
|
|
purescript = {
|
|
|
|
censorWarnings = {
|
|
|
|
"UnusedName",
|
|
|
|
"ShadowedName",
|
|
|
|
"UserDefinedWarning",
|
|
|
|
},
|
|
|
|
formatter = "purs-tidy",
|
2023-03-30 02:54:57 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-02-24 01:53:32 +01:00
|
|
|
-- }}}
|
|
|
|
-- {{{ Lua
|
|
|
|
lua_ls = {
|
|
|
|
settings = {
|
|
|
|
Lua = {
|
|
|
|
format = {
|
|
|
|
enable = true,
|
|
|
|
},
|
|
|
|
-- Do not send telemetry data containing a randomized but unique identifier
|
|
|
|
telemetry = {
|
|
|
|
enable = false,
|
2023-01-10 02:38:06 +01:00
|
|
|
},
|
|
|
|
},
|
2024-02-24 01:53:32 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
-- }}}
|
|
|
|
-- {{{ Latex
|
|
|
|
texlab = {
|
|
|
|
settings = {
|
|
|
|
texlab = {
|
|
|
|
build = {
|
|
|
|
args = {
|
|
|
|
-- Here by default:
|
|
|
|
"-pdf",
|
|
|
|
"-interaction=nonstopmode",
|
|
|
|
"-synctex=1",
|
|
|
|
"%f",
|
2024-03-09 16:57:38 +01:00
|
|
|
-- Required for syntax highlighting inside the generated pdf apparently
|
2024-02-24 01:53:32 +01:00
|
|
|
"-shell-escape",
|
|
|
|
},
|
|
|
|
executable = "latexmk",
|
|
|
|
forwardSearchAfter = true,
|
|
|
|
onSave = true,
|
|
|
|
},
|
|
|
|
chktex = {
|
|
|
|
onOpenAndSave = true,
|
|
|
|
onEdit = true,
|
|
|
|
},
|
2023-04-25 15:35:09 +02:00
|
|
|
},
|
2023-01-10 02:38:06 +01:00
|
|
|
},
|
|
|
|
},
|
2024-02-24 01:53:32 +01:00
|
|
|
-- }}}
|
|
|
|
-- {{{ Nix
|
|
|
|
rnix = {},
|
|
|
|
-- nil_ls = {},
|
|
|
|
nixd = {},
|
|
|
|
-- }}}
|
|
|
|
cssls = {},
|
|
|
|
jsonls = {},
|
|
|
|
dhall_lsp_server = {},
|
2024-02-28 07:16:21 +01:00
|
|
|
typst_lsp = {
|
|
|
|
exportPdf = "onType",
|
|
|
|
},
|
2024-02-24 01:53:32 +01:00
|
|
|
elmls = {},
|
2023-06-15 20:08:20 +02:00
|
|
|
}
|
2024-02-24 01:53:32 +01:00
|
|
|
-- }}}
|
2023-06-15 20:08:20 +02:00
|
|
|
|
2023-01-10 02:38:06 +01:00
|
|
|
local capabilities = M.capabilities()
|
|
|
|
for lsp, details in pairs(servers) do
|
2024-01-04 05:24:55 +01:00
|
|
|
details.capabilities = capabilities
|
2024-02-24 01:53:32 +01:00
|
|
|
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
|