142 lines
3.3 KiB
Lua
142 lines
3.3 KiB
Lua
local M = {}
|
|
|
|
M.setup_server = function(lspconfig, capabilities, on_attach)
|
|
-- lspconfig['pyright'].setup {
|
|
-- capabilities = capabilities,
|
|
-- on_attach = on_attach,
|
|
-- }
|
|
|
|
lspconfig['basedpyright'].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = {
|
|
basedpyright = {
|
|
typeCheckingMode = 'standard',
|
|
},
|
|
},
|
|
})
|
|
|
|
lspconfig['ruff'].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
lspconfig['groovyls'].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- lspconfig['cmake'].setup {
|
|
-- capabilities = capabilities,
|
|
-- on_attach = on_attach,
|
|
-- }
|
|
|
|
local clangd_capabilities = capabilities
|
|
clangd_capabilities.textDocument.semanticHighlighting = true
|
|
clangd_capabilities.offsetEncoding = { 'utf-16' }
|
|
lspconfig['clangd'].setup({
|
|
capabilities = clangd_capabilities,
|
|
on_attach = on_attach,
|
|
cmd = {
|
|
'clangd',
|
|
'--compile-commands-dir=build_nvim',
|
|
'--query-driver',
|
|
'/opt/cortex-a78-2022.08-gcc12.1-linux5.15/bin/aarch64-linux-gnu-g*',
|
|
'--clang-tidy',
|
|
'--background-index',
|
|
'--use-dirty-headers',
|
|
'--completion-style=detailed',
|
|
},
|
|
root_dir = lspconfig.util.root_pattern('.clangd', '.clang-tidy', '.clang-format', 'compile_flags.txt', 'configure.ac', '.git', 'build_nvim'),
|
|
})
|
|
|
|
require('clangd_extensions').setup({
|
|
extensions = {
|
|
inlay_hints = {
|
|
-- Only show inlay hints for the current line
|
|
only_current_line = true,
|
|
},
|
|
},
|
|
})
|
|
|
|
lspconfig['jsonls'].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- lspconfig['rust_analyzer'].setup {
|
|
-- capabilities = capabilities,
|
|
-- on_attach = on_attach,
|
|
-- }
|
|
|
|
lspconfig['lua_ls'].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = {
|
|
Lua = {
|
|
workspace = {
|
|
checkThirdParty = false,
|
|
},
|
|
completion = {
|
|
callSnippet = 'Replace',
|
|
},
|
|
-- Do not send telemetry data containing a randomized but unique identifier
|
|
telemetry = {
|
|
enable = false,
|
|
},
|
|
format = {
|
|
enable = true,
|
|
defaultConfig = {
|
|
indent_style = 'space',
|
|
indent_size = '2',
|
|
quote_style = 'single',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
lspconfig['dockerls'].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
lspconfig['markdown_oxide'].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
-- lspconfig['marksman'].setup {
|
|
-- capabilities = capabilities,
|
|
-- on_attach = on_attach,
|
|
-- }
|
|
|
|
lspconfig['yamlls'].setup({
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = {
|
|
yaml = {
|
|
validate = true,
|
|
},
|
|
},
|
|
})
|
|
|
|
local configs = require('lspconfig.configs')
|
|
if not configs.neocmake then
|
|
configs.neocmake = {
|
|
default_config = {
|
|
cmd = { 'neocmakelsp', '--stdio' },
|
|
filetypes = { 'cmake' },
|
|
root_dir = function(fname)
|
|
return lspconfig.util.find_git_ancestor(fname)
|
|
end,
|
|
single_file_support = true, -- suggested
|
|
on_attach = on_attach, -- on_attach is the on_attach function you defined
|
|
},
|
|
}
|
|
lspconfig.neocmake.setup({})
|
|
end
|
|
end
|
|
|
|
return M
|