169 lines
6.3 KiB
Lua
169 lines
6.3 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 not NV_DARCULA_ENABLE_COC then
|
|
return
|
|
end
|
|
|
|
require("darcula.utils.table")
|
|
|
|
local coc_config = vim.fn["coc#config"]
|
|
local utils = require("darcula.utils")
|
|
local utils_os = require("darcula.utils.os")
|
|
|
|
utils.copy_file(
|
|
utils.iff(
|
|
utils_os.is_windows,
|
|
vim.fs.joinpath(vim.fn.stdpath("config"), "coc-settings.windows.json"),
|
|
vim.fs.joinpath(vim.fn.stdpath("config"), "coc-settings.unix.json")
|
|
),
|
|
vim.fs.joinpath(vim.fn.stdpath("config"), "coc-settings.json")
|
|
)
|
|
|
|
vim.g.coc_data_home = vim.fs.joinpath(vim.fn.stdpath("data"), "coc")
|
|
|
|
-- local coc_get_config = vim.fn["coc#util#get_config"]
|
|
-- M.plug_end = function(lua_library_list)
|
|
-- utils.augroup_with_autocmd(
|
|
-- "coc_config_lua_cfg",
|
|
-- "User",
|
|
-- "CocNvimInit",
|
|
-- function()
|
|
-- local workspace = coc_get_config("Lua").workspace or {}
|
|
-- local library = workspace.library or {}
|
|
--
|
|
-- for _, name in pairs(lua_library_list) do
|
|
-- local lib = vim.fs.joinpath(vim.g.plug_home, name, "lua")
|
|
-- if not table.contains(library, lib) then
|
|
-- table.insert(library, lib)
|
|
-- end
|
|
-- end
|
|
--
|
|
-- table.insert(library, "/usr/share/awesome/lib")
|
|
--
|
|
-- coc_config("Lua.workspace", {library = library})
|
|
-- end
|
|
-- )
|
|
-- end
|
|
|
|
local symbols = require("darcula.utils.symbols")
|
|
|
|
vim.g.coc_global_extensions = NV_DARCULA_COC_EXTENSIONS
|
|
vim.g.coc_snippet_next = "<tab>"
|
|
vim.g.coc_snippet_prev = "<s-tab>"
|
|
|
|
local float_config = {
|
|
winblend = 0,
|
|
border = true,
|
|
rounded = true,
|
|
maxWidth = 120
|
|
}
|
|
coc_config("Lua.codeLens.enable", NV_DARCULA_ENABLE_CODE_LENS)
|
|
coc_config("Lua.completion.callSnippet", "Replace")
|
|
coc_config("Lua.diagnostics.globals", NV_DARCULA_LUA_GLOBALS)
|
|
coc_config("Lua.diagnostics.workspaceDelay", 30000)
|
|
coc_config("Lua.hint.enable", NV_DARCULA_ENABLE_INLAY_HINTS)
|
|
coc_config("Lua.telemetry.enable", false)
|
|
coc_config("Lua.workspace.checkThirdParty", false)
|
|
coc_config("Lua.workspace.maxPreload", 10000)
|
|
coc_config("Lua.workspace.preloadFileSize", 3000)
|
|
coc_config("cSpell.enabledLanguageIds", NV_DARCULA_CSPELL_LANGUAGES)
|
|
coc_config("cSpell.import", {"./"})
|
|
coc_config("clangd.arguments", NV_DARCULA_CLANGD_ARGS)
|
|
if utils_os.is_windows then
|
|
coc_config("clangd.path", "c:\\bin\\clangd.cmd")
|
|
end
|
|
coc_config("clangd.inlayHint.enable", NV_DARCULA_ENABLE_INLAY_HINTS)
|
|
coc_config("coc.preferences.colorSupport", false)
|
|
coc_config("coc.preferences.maxFileSize", "10MB")
|
|
coc_config("codeLens.enable", NV_DARCULA_ENABLE_CODE_LENS)
|
|
coc_config("diagnostic.enableHighlightLineNumber", true)
|
|
coc_config("diagnostic.errorSign", symbols.line.errors)
|
|
coc_config("diagnostic.floatConfig", float_config)
|
|
coc_config("diagnostic.hintSign", symbols.line.hints)
|
|
coc_config("diagnostic.infoSign", symbols.line.info)
|
|
coc_config("diagnostic.level", "hint")
|
|
coc_config("diagnostic.virtualText", NV_DARCULA_ENABLE_VIRTUAL_TEXT)
|
|
coc_config("diagnostic.virtualTextPrefix", symbols.line.info .. " ")
|
|
coc_config("diagnostic.warningSign", symbols.line.warnings)
|
|
coc_config("highlight.colorNames.enable", false)
|
|
coc_config("highlight.colors.enable", false)
|
|
coc_config("highlight.document.enable", false)
|
|
coc_config("hover.autoHide", false)
|
|
coc_config("hover.floatConfig", float_config)
|
|
coc_config("inlayHint.display", NV_DARCULA_ENABLE_INLAY_HINTS)
|
|
coc_config("inlayHint.enable", NV_DARCULA_ENABLE_INLAY_HINTS)
|
|
coc_config("inlayHint.enableParameter", NV_DARCULA_ENABLE_INLAY_HINTS)
|
|
coc_config("inlayHint.refreshOnInsertMode", NV_DARCULA_ENABLE_INLAY_HINTS)
|
|
if not utils_os.is_windows then
|
|
coc_config("jedi.executable.command", "jedi-language-server")
|
|
end
|
|
coc_config("java.import.maven.enabled", true)
|
|
coc_config("java.jdt.ls.lombokSupport.enabled", true)
|
|
coc_config(
|
|
"java.jdt.ls.vmargs",
|
|
"-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx4G -Xms4G -Xlog:disable"
|
|
)
|
|
coc_config("java.maven.downloadSources", false)
|
|
coc_config("java.maven.updateSnapshots", true)
|
|
coc_config("java.referencesCodeLens.enabled", NV_DARCULA_ENABLE_CODE_LENS)
|
|
coc_config("java.trace.server", "verbose")
|
|
coc_config("lightbulb.enableSign", not NV_DARCULA_ENABLE_VIRTUAL_TEXT)
|
|
coc_config("lightbulb.enableVirtualText", NV_DARCULA_ENABLE_VIRTUAL_TEXT)
|
|
coc_config(
|
|
"lightbulb.text",
|
|
{default = symbols.status.info, quickfix = symbols.status.fix}
|
|
)
|
|
coc_config("notification.border", true)
|
|
coc_config("notification.highlightGroup", "CocFloating")
|
|
coc_config("notification.statusLineProgress", true)
|
|
coc_config("notification.winblend", 0)
|
|
coc_config("signature.floatConfig", float_config)
|
|
coc_config("signature.hideOnTextChange", false)
|
|
coc_config("suggest.floatConfig", float_config)
|
|
coc_config("suggest.keepCompleteopt", true)
|
|
coc_config("suggest.noselect", true)
|
|
coc_config("suggest.virtualText", NV_DARCULA_ENABLE_VIRTUAL_TEXT)
|
|
coc_config("sumneko-lua.enableNvimLuaDev", true)
|
|
|
|
coc_config(
|
|
"languageserver",
|
|
{
|
|
vala = {
|
|
command = "vala-language-server",
|
|
filetypes = {"vala", "genie"}
|
|
}
|
|
}
|
|
)
|
|
|
|
if utils_os.is_windows then
|
|
coc_config(
|
|
"sh.commandPath",
|
|
vim.fs.joinpath(
|
|
vim.g.coc_data_home,
|
|
"extensions",
|
|
"node_modules",
|
|
"coc-sh",
|
|
"node_modules",
|
|
".bin",
|
|
"bash-language-server.cmd"
|
|
)
|
|
)
|
|
end
|