♻️ refactor(config): streamline plugins and LSP configurations for improved maintainability
This commit is contained in:
21 files changed
+171
-1281
No files matched your search
@@ -8,30 +8,27 @@ if auto_install then
|
||||
end
|
||||
|
||||
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||
|
||||
-- Function to load LSP config from separate files
|
||||
local function load_lsp_config(server_name)
|
||||
local config_path = 'lsp.' .. server_name
|
||||
local ok, config = pcall(require, config_path)
|
||||
if ok then
|
||||
return config
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local default_setup = function(server)
|
||||
if server == 'tailwindcss' then
|
||||
lspconfig[server].setup({
|
||||
-- Check if there's a separate config file for this server
|
||||
local custom_config = load_lsp_config(server)
|
||||
|
||||
if custom_config then
|
||||
-- Use the custom configuration and add capabilities
|
||||
local config = vim.tbl_deep_extend('force', custom_config, {
|
||||
capabilities = capabilities,
|
||||
filetypes = {
|
||||
'html',
|
||||
'css',
|
||||
'scss',
|
||||
'javascript',
|
||||
'javascriptreact',
|
||||
'typescript',
|
||||
'typescriptreact',
|
||||
'vue',
|
||||
'svelte',
|
||||
},
|
||||
init_options = {
|
||||
userLanguages = {
|
||||
['javascript'] = 'javascript',
|
||||
['javascriptreact'] = 'javascript',
|
||||
['typescript'] = 'typescript',
|
||||
['typescriptreact'] = 'typescript',
|
||||
},
|
||||
},
|
||||
})
|
||||
lspconfig[server].setup(config)
|
||||
else
|
||||
lspconfig[server].setup({
|
||||
capabilities = capabilities,
|
||||
@@ -44,6 +41,22 @@ require('mason-lspconfig').setup({
|
||||
handlers = { default_setup },
|
||||
})
|
||||
|
||||
-- Setup servers that don't come from Mason
|
||||
-- Dart language server (comes with Dart SDK)
|
||||
if vim.fn.executable('dart') == 1 then
|
||||
local dart_config = load_lsp_config('dartls')
|
||||
if dart_config then
|
||||
local config = vim.tbl_deep_extend('force', dart_config, {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
lspconfig.dartls.setup(config)
|
||||
else
|
||||
lspconfig.dartls.setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
local signs = { Error = icons.Error, Warn = icons.Warning, Hint = icons.Hint, Info = icons.Information }
|
||||
vim.diagnostic.config({
|
||||
underline = true,
|
||||
|
||||
Reference in new issue
Block a user