153 lines
4.4 KiB
Lua
153 lines
4.4 KiB
Lua
-- The MIT License (MIT)
|
|
--
|
|
-- Copyright © 2026 Scott E. Graves <scott.e.graves@protonmail.com>
|
|
--
|
|
-- Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
-- and associated documentation files (the “Software”), to deal in the Software without restriction,
|
|
-- including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
|
-- sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
|
-- furnished to do so, subject to the following conditions:
|
|
--
|
|
-- The above copyright notice and this permission notice shall be included in all copies or
|
|
-- substantial portions of the Software.
|
|
--
|
|
-- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
|
-- BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
-- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
--
|
|
if NV_DARCULA_ENABLE_COC then
|
|
return
|
|
end
|
|
|
|
---@diagnostic disable-next-line: deprecated
|
|
local unpacker = table.unpack or unpack
|
|
|
|
require("mason-lspconfig").setup {
|
|
automatic_enable = NV_DARCULA_MASON_LSP_LIST
|
|
}
|
|
|
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
|
|
|
vim.lsp.config("*", {capabilities = capabilities})
|
|
|
|
for _, name in pairs(NV_DARCULA_MASON_LSP_LIST) do
|
|
if name == "clangd" then
|
|
vim.lsp.config(
|
|
"clangd",
|
|
{
|
|
cmd = {
|
|
"clangd",
|
|
unpacker(NV_DARCULA_CLANGD_ARGS)
|
|
}
|
|
}
|
|
)
|
|
elseif name == "cspell_ls" then
|
|
local cspell_capabilities = vim.deepcopy(capabilities)
|
|
cspell_capabilities.workspace = {
|
|
didChangeWatchedFiles = {
|
|
dynamicRegistration = false
|
|
}
|
|
}
|
|
|
|
vim.lsp.config(
|
|
name,
|
|
{
|
|
capabilities = cspell_capabilities,
|
|
init_options = {
|
|
defaultSettings = {
|
|
enabledLanguageIds = NV_DARCULA_CSPELL_LANGUAGES,
|
|
import = {"./"}
|
|
}
|
|
}
|
|
}
|
|
)
|
|
elseif name == "jdtls" then
|
|
local lombok =
|
|
vim.fs.joinpath(NV_DARCULA_MASON_ROOT, "packages", "jdtls", "lombok.jar")
|
|
vim.env.JDTLS_JVM_ARGS =
|
|
table.concat(
|
|
{
|
|
"-XX:+UseParallelGC",
|
|
"-XX:GCTimeRatio=4",
|
|
"-XX:AdaptiveSizePolicyWeight=90",
|
|
"-Dsun.zip.disableMemoryMapping=true",
|
|
"-Xmx4G",
|
|
"-Xms4G",
|
|
"-Xlog:disable",
|
|
"-javaagent:" .. lombok
|
|
},
|
|
" "
|
|
)
|
|
|
|
vim.lsp.config(
|
|
name,
|
|
{
|
|
settings = {
|
|
java = {
|
|
import = {maven = {enabled = true}},
|
|
jdt = {
|
|
ls = {
|
|
lombokSupport = {enabled = true},
|
|
vmargs = vim.env.JDTLS_JVM_ARGS
|
|
}
|
|
},
|
|
maven = {
|
|
downloadSources = false,
|
|
updateSnapshots = true
|
|
},
|
|
referencesCodeLens = {enabled = NV_DARCULA_ENABLE_CODE_LENS},
|
|
trace = {server = "verbose"}
|
|
}
|
|
}
|
|
}
|
|
)
|
|
elseif name == "lua_ls" then
|
|
vim.lsp.config(
|
|
name,
|
|
{
|
|
settings = {
|
|
Lua = {
|
|
codeLens = {enable = NV_DARCULA_ENABLE_CODE_LENS},
|
|
completion = {
|
|
callSnippet = "Replace",
|
|
keywordSnippet = "Both"
|
|
},
|
|
diagnostics = {
|
|
globals = NV_DARCULA_LUA_GLOBALS,
|
|
workspaceDelay = 30000
|
|
},
|
|
hint = {enable = NV_DARCULA_ENABLE_INLAY_HINTS},
|
|
runtime = {
|
|
version = "LuaJIT"
|
|
},
|
|
telemetry = {enable = false},
|
|
workspace = {
|
|
checkThirdParty = false,
|
|
library = {
|
|
vim.env.VIMRUNTIME,
|
|
vim.fn.stdpath("config")
|
|
-- vim.fs.joinpath(
|
|
-- vim.fn.stdpath("data"),
|
|
-- "site",
|
|
-- "pack",
|
|
-- "core",
|
|
-- "opt"
|
|
-- )
|
|
},
|
|
maxPreload = 10000,
|
|
preloadFileSize = 3000
|
|
}
|
|
}
|
|
}
|
|
}
|
|
)
|
|
elseif name == "vala_ls" then
|
|
vim.lsp.config(name, {})
|
|
vim.lsp.enable(name)
|
|
else
|
|
vim.lsp.config(name, {})
|
|
end
|
|
end
|