Try configuring language servers
This commit is contained in:
@@ -1,24 +1,101 @@
|
||||
-- load defaults i.e lua_lsp
|
||||
-----------------------------------------------------------
|
||||
-- LSP Configuration
|
||||
-----------------------------------------------------------
|
||||
|
||||
-- Load NvChad LSP defaults
|
||||
require("nvchad.configs.lspconfig").defaults()
|
||||
|
||||
local lspconfig = require "lspconfig"
|
||||
local lspconfig = require("lspconfig")
|
||||
local nvlsp = require("nvchad.configs.lspconfig")
|
||||
|
||||
-- EXAMPLE
|
||||
local servers = { "html", "cssls" }
|
||||
local nvlsp = require "nvchad.configs.lspconfig"
|
||||
-----------------------------------------------------------
|
||||
-- Language Server Configurations
|
||||
-----------------------------------------------------------
|
||||
|
||||
-- lsps with default config
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = nvlsp.on_attach,
|
||||
on_init = nvlsp.on_init,
|
||||
capabilities = nvlsp.capabilities,
|
||||
}
|
||||
end
|
||||
local servers = {
|
||||
-----------------------------------------------------------
|
||||
-- Web Development
|
||||
-----------------------------------------------------------
|
||||
-- HTML & CSS
|
||||
emmet_language_server = {},
|
||||
html = {},
|
||||
cssls = {},
|
||||
|
||||
-- JavaScript & Frameworks
|
||||
svelte = {},
|
||||
astro = {},
|
||||
|
||||
-- Tailwind CSS
|
||||
tailwindcss = {
|
||||
settings = {
|
||||
tailwindCSS = {
|
||||
experimental = {
|
||||
classRegex = {
|
||||
{ "cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]" },
|
||||
{ "cx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)" },
|
||||
{ "cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- JSON & Linting
|
||||
jsonls = {},
|
||||
eslint = {},
|
||||
|
||||
-- configuring single server, example: typescript
|
||||
-- lspconfig.ts_ls.setup {
|
||||
-- on_attach = nvlsp.on_attach,
|
||||
-- on_init = nvlsp.on_init,
|
||||
-- capabilities = nvlsp.capabilities,
|
||||
-- }
|
||||
-----------------------------------------------------------
|
||||
-- DevOps & Infrastructure
|
||||
-----------------------------------------------------------
|
||||
-- Docker
|
||||
docker_compose_language_service = {},
|
||||
dockerls = {},
|
||||
|
||||
-- Server Configuration
|
||||
nginx_language_server = {},
|
||||
|
||||
-----------------------------------------------------------
|
||||
-- Systems Programming
|
||||
-----------------------------------------------------------
|
||||
-- Rust
|
||||
rust_analyzer = {},
|
||||
|
||||
-- C/C++
|
||||
clangd = {},
|
||||
|
||||
-- Go
|
||||
gopls = {},
|
||||
|
||||
-----------------------------------------------------------
|
||||
-- Scripting & Configuration
|
||||
-----------------------------------------------------------
|
||||
-- Lua
|
||||
lua_ls = {},
|
||||
|
||||
-- Nix
|
||||
nixd = {},
|
||||
|
||||
-- C# (currently disabled)
|
||||
-- csharp_ls = {},
|
||||
|
||||
-----------------------------------------------------------
|
||||
-- Database & Backend
|
||||
-----------------------------------------------------------
|
||||
-- SQL
|
||||
sqls = {},
|
||||
|
||||
-- PHP
|
||||
phpactor = {},
|
||||
}
|
||||
|
||||
-----------------------------------------------------------
|
||||
-- Apply Server Configurations
|
||||
-----------------------------------------------------------
|
||||
|
||||
-- Iterate through servers and apply common configuration
|
||||
for name, opts in pairs(servers) do
|
||||
opts.on_init = nvlsp.on_init
|
||||
opts.on_attach = nvlsp.on_attach
|
||||
opts.capabilities = nvlsp.capabilities
|
||||
lspconfig[name].setup(opts)
|
||||
end
|
||||
Reference in New Issue
Block a user