69 lines
1.5 KiB
Lua
69 lines
1.5 KiB
Lua
local lspconfig = require("lspconfig")
|
|
|
|
--vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
|
--virtual_text = true,
|
|
--})
|
|
|
|
lspconfig.pyright.setup({})
|
|
|
|
lspconfig.clangd.setup({})
|
|
|
|
lspconfig.rust_analyzer.setup({})
|
|
|
|
lspconfig.nil_ls.setup({})
|
|
|
|
lspconfig.r_language_server.setup({})
|
|
|
|
lspconfig.qmlls.setup({})
|
|
|
|
lspconfig.lua_ls.setup({
|
|
on_init = function(client)
|
|
if client.workspace_folders then
|
|
local path = client.workspace_folders[1].name
|
|
if vim.uv.fs_stat(path .. "/.luarc.json") or vim.uv.fs_stat(path .. "/.luarc.jsonc") then
|
|
return
|
|
end
|
|
end
|
|
|
|
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
|
|
runtime = {
|
|
version = "LuaJIT",
|
|
},
|
|
workspace = {
|
|
checkThirdParty = false,
|
|
library = {
|
|
vim.env.VIMRUNTIME,
|
|
},
|
|
},
|
|
})
|
|
end,
|
|
settings = {
|
|
Lua = {
|
|
hint = { enable = true },
|
|
},
|
|
},
|
|
single_file_support = true,
|
|
})
|
|
|
|
lspconfig.bashls.setup({})
|
|
|
|
lspconfig.zls.setup({})
|
|
|
|
lspconfig.ts_ls.setup({})
|
|
|
|
lspconfig.tinymist.setup({
|
|
single_file_support = true,
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd("LspAttach", {
|
|
callback = function(args)
|
|
local bufnr = args.buf ---@type number
|
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
|
if client.supports_method("textDocument/inlayHint") then
|
|
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
|
vim.keymap.set("n", "<leader>i", function()
|
|
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr })
|
|
end, { buffer = bufnr })
|
|
end
|
|
end,
|
|
})
|