dotfiles/.config/nvim/lua/plugins/lspconfig.lua
2025-05-05 06:58:49 +02:00

95 lines
2.6 KiB
Lua

local lspconfig = require('lspconfig')
local lsp_defaults = lspconfig.util.default_config
lsp_defaults.capabilities = vim.tbl_deep_extend(
'force',
lsp_defaults.capabilities,
require('cmp_nvim_lsp').default_capabilities()
)
lspconfig.denols.setup({
on_attach = on_attach,
root_dir = lspconfig.util.root_pattern("deno.json", "deno.jsonc"),
})
lspconfig.ts_ls.setup({
on_attach = on_attach,
root_dir = lspconfig.util.root_pattern("pnpm-workspace.yaml", "package.json"),
single_file_support = false,
settings = {
typescript = {
inlayHints = {
includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
}
},
javascript = {
inlayHints = {
includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
}
}
}
})
require'lspconfig'.rust_analyzer.setup {
settings = {
['rust-analyzer'] = {
inlayHints = {
includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
checkOnSave = {
command = 'clippy'
}
},
},
}
require('lspconfig').tailwindcss.setup({
settings = {
tailwindCSS = {
experimental = {
classRegex = {
{ "tv\\((([^()]*|\\([^()]*\\))*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]" }
},
},
},
},
})
require 'lspconfig'.eslint.setup({
settings = {
packageManager = 'npm'
},
on_attach = function(client, bufnr)
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = bufnr,
command = "EslintFixAll",
})
end,
})
--lspconfig.graphql.setup({
-- root_dir = lspconfig.util.root_pattern(".graphqlconfig", ".graphqlrc", "package.json"),
-- flags = {
-- debounce_text_changes = 150,
-- },
--})