Dotfiles_nvim/lua/toolchain/angular.lua
2025-02-26 08:08:54 +01:00

56 lines
1.5 KiB
Lua

local T = require('toolchain')
local M = {}
local K = require('core.keymap')
function M.setup()
T.add_highlighter_autoinstalls('angular')
T.add_lsp_autoinstalls('angularls')
T.add_lsps(function(lspconfig, capabilities)
local cmd = {
vim.env.VOLTA_HOME .. '/bin/ngserver',
'--stdio',
'--tsProbeLocations',
vim.env.VOLTA_HOME,
'--ngProbeLocations',
vim.env.VOLTA_HOME,
}
lspconfig.angularls.setup({
capabilities = capabilities,
cmd = cmd,
on_new_config = function(new_config, _new_root_dir)
new_config.cmd = cmd
end,
})
end)
T.add_plugins({
'joeveiga/ng.nvim',
config = function()
local ng = require('ng')
vim.keymap.set(
K.ANGULAR.COMPONENT.mode,
K.ANGULAR.COMPONENT.shortcut,
ng.goto_component_with_template_file,
{
noremap = true,
silent = true,
desc = K.ANGULAR.COMPONENT.description,
}
)
vim.keymap.set(
K.ANGULAR.TEMPLATE.mode,
K.ANGULAR.TEMPLATE.shortcut,
ng.goto_template_for_component,
{
noremap = true,
silent = true,
desc = K.ANGULAR.TEMPLATE.description,
}
)
end,
})
end
return M