146 lines
5.3 KiB
Lua
146 lines
5.3 KiB
Lua
--- @type LazyPluginSpec
|
|
return {
|
|
"neovim/nvim-lspconfig",
|
|
dependencies = {
|
|
{ "antosha417/nvim-lsp-file-operations", config = true },
|
|
-- "hrsh7th/cmp-nvim-lsp",
|
|
"saghen/blink.cmp",
|
|
"nvim-lua/plenary.nvim",
|
|
"pmizio/typescript-tools.nvim",
|
|
"dmmulroy/ts-error-translator.nvim",
|
|
},
|
|
event = { "BufReadPre", "BufNewFile" },
|
|
config = function()
|
|
local tserrortranslator = require("ts-error-translator")
|
|
local on_attach = require("taken.utils.on_attach")
|
|
local get_python_path = require("taken.utils.lsp").get_python_path
|
|
|
|
-- local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
|
-- local capabilities = cmp_nvim_lsp.default_capabilities()
|
|
|
|
local blink = require("blink.cmp")
|
|
local capabilities = blink.get_lsp_capabilities()
|
|
|
|
vim.diagnostic.config({
|
|
signs = {
|
|
[vim.diagnostic.severity.ERROR] = " ",
|
|
[vim.diagnostic.severity.WARN] = " ",
|
|
[vim.diagnostic.severity.HINT] = "ﴞ ",
|
|
[vim.diagnostic.severity.INFO] = " ",
|
|
},
|
|
})
|
|
|
|
local defaultLsps = {
|
|
"html",
|
|
"cssls",
|
|
"jsonls",
|
|
"rust_analyzer",
|
|
"yamlls",
|
|
"bashls",
|
|
"marksman",
|
|
"eslint",
|
|
"cspell_ls",
|
|
"kulala_ls",
|
|
-- "emmylua_ls",
|
|
}
|
|
|
|
vim.lsp.config("*", {
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
})
|
|
|
|
local lsps = {
|
|
{
|
|
lsp = "lua_ls",
|
|
config = {
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = {
|
|
Lua = {
|
|
hint = {
|
|
enable = true,
|
|
},
|
|
runtime = {
|
|
version = "LuaJIT",
|
|
},
|
|
diagnostics = {
|
|
globals = { "vim" },
|
|
},
|
|
completion = {
|
|
callSnippet = "Replace",
|
|
},
|
|
format = {
|
|
enable = false,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
lsp = "pyright",
|
|
config = {
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
before_init = function(_, config)
|
|
local python_path = get_python_path(config.root_dir)
|
|
if python_path == nil then
|
|
return
|
|
end
|
|
config.settings.python.pythonPath = get_python_path(config.root_dir)
|
|
end,
|
|
},
|
|
},
|
|
{
|
|
lsp = "ts_ls",
|
|
config = {
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
settings = {
|
|
typescript = {
|
|
inlayHints = {
|
|
includeInlayParameterNameHints = "all",
|
|
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
|
|
includeInlayFunctionParameterTypeHints = true,
|
|
includeInlayVariableTypeHints = true,
|
|
includeInlayVariableTypeHintsWhenTypeMatchesName = true,
|
|
includeInlayPropertyDeclarationTypeHints = true,
|
|
includeInlayFunctionLikeReturnTypeHints = true,
|
|
includeInlayEnumMemberValueHints = true,
|
|
},
|
|
},
|
|
javascript = {
|
|
inlayHints = {
|
|
includeInlayParameterNameHints = "all",
|
|
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
|
|
includeInlayFunctionParameterTypeHints = true,
|
|
includeInlayVariableTypeHints = true,
|
|
includeInlayVariableTypeHintsWhenTypeMatchesName = true,
|
|
includeInlayPropertyDeclarationTypeHints = true,
|
|
includeInlayFunctionLikeReturnTypeHints = true,
|
|
includeInlayEnumMemberValueHints = true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
lsp = "powershell_es",
|
|
config = {
|
|
capabilities = capabilities,
|
|
on_attach = on_attach,
|
|
bundle_path = vim.fn.stdpath("data") .. "/mason/packages/powershell-editor-services",
|
|
},
|
|
},
|
|
}
|
|
|
|
vim.lsp.enable(defaultLsps)
|
|
|
|
for _, l in ipairs(lsps) do
|
|
vim.lsp.config(l.lsp, l.config)
|
|
vim.lsp.enable(l.lsp)
|
|
end
|
|
|
|
tserrortranslator.setup()
|
|
end,
|
|
}
|