feat: consolidate Mason configuration and add new plugins for enhanced development workflow
- Refactor community.lua module structure for better readability - Remove obsolete Mason configuration file - Add new plugins: nvim-lsp-file-operations, nvim-vtsls, package-info.nvim, tsc.nvim - Implement dynamic Mason package installation based on FRAMEWORK environment variable - Create custom command 'MasonInstallR' for framework-specific tool installation Signed-off-by: User <user@example.com>
This commit is contained in:
+16
-8
@@ -60,14 +60,22 @@ local function get_ai_modules()
|
||||
return nil
|
||||
end
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
---@type LazySpec[]
|
||||
local modules = {
|
||||
-- Base AstroCommunity plugin
|
||||
"AstroNvim/astrocommunity",
|
||||
|
||||
-- Framework-specific modules
|
||||
unpack(get_framework_modules()),
|
||||
|
||||
-- AI modules if enabled
|
||||
get_ai_modules(),
|
||||
}
|
||||
|
||||
-- Add framework-specific modules
|
||||
local framework_modules = get_framework_modules()
|
||||
for _, module in ipairs(framework_modules) do
|
||||
table.insert(modules, module)
|
||||
end
|
||||
|
||||
-- Add AI modules if enabled
|
||||
local ai_module = get_ai_modules()
|
||||
if ai_module then
|
||||
table.insert(modules, ai_module)
|
||||
end
|
||||
|
||||
return modules
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
-- Mason plugin configuration for automatic tool installation
|
||||
-- Dynamically installs tools based on the FRAMEWORK environment variable
|
||||
|
||||
-- Framework-specific tool configurations
|
||||
local FRAMEWORK_TOOLS = {
|
||||
python = {
|
||||
"black",
|
||||
"python-lsp-server",
|
||||
"mypy",
|
||||
"pylint",
|
||||
"flake8",
|
||||
"pylama",
|
||||
"bandit",
|
||||
"pydocstyle",
|
||||
"pyproject-flake8",
|
||||
"pyproject-fmt",
|
||||
"reorder-python-imports",
|
||||
},
|
||||
vue = {
|
||||
"eslint-lsp",
|
||||
"stylelint-lsp",
|
||||
"tailwindcss-language-server",
|
||||
"typescript-language-server",
|
||||
"vue-language-server",
|
||||
"stylelint",
|
||||
"prettier",
|
||||
}
|
||||
}
|
||||
|
||||
--- Retrieves the appropriate tool set based on the current framework environment
|
||||
--- @return table List of tools to install for the detected framework
|
||||
local function get_framework_tools()
|
||||
local current_framework = os.getenv("FRAMEWORK")
|
||||
return FRAMEWORK_TOOLS[current_framework] or {}
|
||||
end
|
||||
|
||||
---@type LazySpec
|
||||
return {
|
||||
-- Mason tool installer for automatic package management
|
||||
{
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
opts = {
|
||||
-- Install tools based on the detected framework
|
||||
ensure_installed = get_framework_tools(),
|
||||
},
|
||||
},
|
||||
}
|
||||
+73
-2
@@ -1,5 +1,76 @@
|
||||
if true then return end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
|
||||
|
||||
-- This will run last in the setup process.
|
||||
-- This is just pure lua so anything that doesn't
|
||||
-- fit in the normal config locations above can go here
|
||||
|
||||
-- Framework-specific tool configurations
|
||||
local FRAMEWORK_TOOLS = {
|
||||
python = {
|
||||
"black",
|
||||
"python-lsp-server",
|
||||
"mypy",
|
||||
"pylint",
|
||||
"flake8",
|
||||
"pylama",
|
||||
"bandit",
|
||||
"pydocstyle",
|
||||
"pyproject-flake8",
|
||||
"pyproject-fmt",
|
||||
"reorder-python-imports",
|
||||
},
|
||||
vue = {
|
||||
"eslint-lsp",
|
||||
"stylelint-lsp",
|
||||
"tailwindcss-language-server",
|
||||
"typescript-language-server",
|
||||
"stylelint",
|
||||
"prettier",
|
||||
},
|
||||
}
|
||||
|
||||
--- Retrieves the appropriate tool set based on the current framework environment
|
||||
--- @return table List of tools to install for the detected framework
|
||||
local function get_framework_tools()
|
||||
local current_framework = os.getenv "FRAMEWORK"
|
||||
print("[DEBUG] Current FRAMEWORK environment variable: " .. tostring(current_framework))
|
||||
|
||||
if current_framework then
|
||||
print("[DEBUG] Available frameworks: " .. vim.inspect(vim.tbl_keys(FRAMEWORK_TOOLS)))
|
||||
local tools = FRAMEWORK_TOOLS[current_framework]
|
||||
print("[DEBUG] Tools for framework '" .. current_framework .. "': " .. vim.inspect(tools))
|
||||
return tools or {}
|
||||
else
|
||||
print "[DEBUG] No FRAMEWORK environment variable set, returning empty list"
|
||||
return {}
|
||||
end
|
||||
end
|
||||
|
||||
-- Функция для установки списка пакетов Mason
|
||||
function InstallMyMasonPackages()
|
||||
print "[DEBUG] Starting InstallMyMasonPackages function"
|
||||
local packages = get_framework_tools()
|
||||
print("[DEBUG] Packages to install: " .. vim.inspect(packages))
|
||||
|
||||
if #packages > 0 then
|
||||
-- Install packages one by one to handle individual failures
|
||||
for _, package in ipairs(packages) do
|
||||
print("[DEBUG] Installing package: " .. package)
|
||||
local success, result = pcall(function() vim.cmd("MasonInstall " .. package) end)
|
||||
|
||||
if not success then
|
||||
print("[WARNING] Failed to install " .. package .. ": " .. tostring(result))
|
||||
else
|
||||
print("[DEBUG] Successfully installed " .. package)
|
||||
end
|
||||
end
|
||||
print "[DEBUG] MasonInstall process completed"
|
||||
else
|
||||
print "[DEBUG] No packages to install, skipping MasonInstall"
|
||||
end
|
||||
end
|
||||
|
||||
-- Создание пользовательской команды
|
||||
vim.api.nvim_create_user_command(
|
||||
"MasonInstallR", -- Имя команды
|
||||
InstallMyMasonPackages, -- Вызываемая функция
|
||||
{ nargs = 0 } -- Команда не принимает аргументов
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user