Files
keycodex/lua/lsp.lua
T
sankalp 9e589bc70c feat(lua): expand LuaLSP, Treesitter and pack helper configurations
Why: improve language support and fix a client API typo

- New Features
  - Added extensive filetype list for Tailwind LSP (astro, blade, ejs, etc.) and enabled the language server
  - Extended Treesitter parser list with regex, latex, tsx, svelte, typst, vue
  - Introduced PackChanged autocmd that notifies on install/update builds
- Enhancements
  - Disabled unused provider loaders (node, perl, python3, ruby)
  - Registered additional filetype handlers for various template extensions
  - Updated markdown style setting and filledchars option
- Bug Fixes
  - Corrected client:supports_method call in autocmd.lua (removed stray colon)
2026-05-08 21:40:46 +05:45

154 lines
3.0 KiB
Lua

--------------------------------------------------------------------------------
-- LSP
--------------------------------------------------------------------------------
vim.api.nvim_create_autocmd("User", {
pattern = "PackerComplete", -- Fallback or custom event if needed, but let's use a more standard one
callback = function()
-- This is where we would put it if we had a specific event.
-- Since we're using VimEnter, let's use that instead.
end,
})
-- Let's use a simple function and schedule it to run after plugins
vim.schedule(function()
vim.lsp.config("*", {
capabilities = require("blink.cmp").get_lsp_capabilities(),
})
-- ts_ls
vim.lsp.config("ts_ls", {
settings = {
typescript = {
inlayHints = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
},
},
})
vim.lsp.enable("ts_ls")
vim.lsp.enable("html")
vim.lsp.enable("cssls")
vim.lsp.config("tailwindcss", {
filetypes = {
"astro",
"blade",
"edge",
"ejs",
"erb",
"gohtml",
"gohtmltmpl",
"handlebars",
"hbs",
"html",
"jade",
"leaf",
"liquid",
"markdown",
"mdx",
"mustache",
"nunjucks",
"php",
"razor",
"slim",
"twig",
"css",
"less",
"postcss",
"sass",
"scss",
"stylus",
"sugarss",
"javascript",
"javascriptreact",
"rescript",
"typescript",
"typescriptreact",
"vue",
"svelte",
"templ",
},
})
vim.lsp.enable("tailwindcss")
-- rust
vim.lsp.config("rust_analyzer", {
settings = {
["rust-analyzer"] = {
diagnostics = {
enable = true,
experimental = { enable = true },
},
},
},
})
vim.lsp.enable("rust_analyzer")
-- lua
vim.lsp.config("lua_ls", {
settings = {
Lua = {
diagnostics = {
disable = {
"missing-fields",
"undefined-global",
},
},
},
},
})
vim.lsp.enable("lua_ls")
-- python
vim.lsp.config("basedpyright", {
settings = {
basedpyright = {
inlayHints = true,
analysis = {
diagnosticSeverityOverrides = {
reportUnusedImport = "none",
reportUnusedVariable = "none",
reportAttributeAccessIssue = "none",
reportUnusedClass = "none",
reportUnusedFunction = "none",
reportDuplicateImport = "none",
reportArgumentType = "error",
},
typeCheckingMode = "standard",
},
},
},
})
vim.lsp.enable("basedpyright")
-- bash
vim.lsp.config("bashls", {
settings = {
bashIde = {
shellcheckArguments = {
"--exclude=SC1090,SC1091,SC2076,SC2164",
},
},
},
})
vim.lsp.enable("bashls")
-- cpp
vim.lsp.config("clangd", {
cmd = {
"clangd",
"--fallback-style=llvm",
"--header-insertion=iwyu",
"-j=4",
},
})
vim.lsp.enable("clangd")
end)