Move lspconfig from lua to nix
This commit is contained in:
parent
e4b7645102
commit
e30d42e8f2
4 changed files with 137 additions and 77 deletions
home/features/neovim/plugins
111
home/features/neovim/plugins/lspconfig.lua
Normal file
111
home/features/neovim/plugins/lspconfig.lua
Normal file
|
@ -0,0 +1,111 @@
|
|||
---@diagnostic disable: missing-fields
|
||||
local M = {}
|
||||
|
||||
-- {{{ 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")
|
||||
|
||||
-- {{{ 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,
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Purescript
|
||||
purescriptls = {
|
||||
root_dir = lspconfig.util.root_pattern("spago.yaml"),
|
||||
settings = {
|
||||
purescript = {
|
||||
censorWarnings = {
|
||||
"UnusedName",
|
||||
"ShadowedName",
|
||||
"UserDefinedWarning",
|
||||
},
|
||||
formatter = "purs-tidy",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Lua
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
format = {
|
||||
enable = true,
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Latex
|
||||
texlab = {
|
||||
settings = {
|
||||
texlab = {
|
||||
build = {
|
||||
args = {
|
||||
-- Here by default:
|
||||
"-pdf",
|
||||
"-interaction=nonstopmode",
|
||||
"-synctex=1",
|
||||
"%f",
|
||||
-- Required for syntax highlighting inside the generated pdf apparently
|
||||
"-shell-escape",
|
||||
},
|
||||
executable = "latexmk",
|
||||
forwardSearchAfter = true,
|
||||
onSave = true,
|
||||
},
|
||||
chktex = {
|
||||
onOpenAndSave = true,
|
||||
onEdit = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- }}}
|
||||
-- {{{ Nix
|
||||
rnix = {},
|
||||
-- nil_ls = {},
|
||||
nixd = {},
|
||||
-- }}}
|
||||
cssls = {},
|
||||
jsonls = {},
|
||||
dhall_lsp_server = {},
|
||||
typst_lsp = {
|
||||
exportPdf = "onType",
|
||||
},
|
||||
elmls = {},
|
||||
}
|
||||
-- }}}
|
||||
|
||||
local capabilities = M.capabilities()
|
||||
for lsp, details in pairs(servers) do
|
||||
details.capabilities = capabilities
|
||||
lspconfig[lsp].setup(details)
|
||||
end
|
||||
end
|
||||
--}}}
|
||||
|
||||
return M
|
Loading…
Add table
Add a link
Reference in a new issue