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

113 lines
2.4 KiB
Lua
Raw Normal View History

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-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-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 = {},
typst_lsp = {
exportPdf = "onType",
},
2024-02-24 01:53:32 +01:00
elmls = {},
2024-05-26 13:20:02 +02:00
csharp_ls = {},
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
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