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

142 lines
3.4 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
2024-02-24 01:53:32 +01:00
local M = {
2023-01-10 02:38:06 +01:00
"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
}
2024-02-24 01:53:32 +01:00
-- {{{ Capabilities
M.capabilities = function()
local c = require("cmp_nvim_lsp").default_capabilities()
-- 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
2023-09-22 20:08:11 +02:00
---@diagnostic disable-next-line: missing-fields
2024-02-24 01:53:32 +01:00
local servers = {
-- {{{ Typescript
---@diagnostic disable-next-line: missing-fields
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 = {
2023-12-04 06:25:00 +01:00
---@diagnostic disable-next-line: missing-fields
2024-02-24 01:53:32 +01:00
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 = {
cmd = {
"lua-language-server",
"--logpath=/home/adrielus/.local/share/lua-language-server/log",
},
settings = {
---@diagnostic disable-next-line: missing-fields
Lua = {
---@diagnostic disable-next-line: missing-fields
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",
-- 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
},
},
2024-02-24 01:53:32 +01:00
-- }}}
-- {{{ Nix
rnix = {},
-- nil_ls = {},
nixd = {},
-- }}}
---@diagnostic disable-next-line: missing-fields
cssls = {},
---@diagnostic disable-next-line: missing-fields
jsonls = {},
dhall_lsp_server = {},
typst_lsp = {},
---@diagnostic disable-next-line: missing-fields
elmls = {},
-- {{{ Inactive
-- pylsp = {},
-- pyright = {},
-- }}}
2023-06-15 20:08:20 +02:00
}
2024-02-24 01:53:32 +01:00
-- }}}
2023-06-15 20:08:20 +02:00
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
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