67 lines
1.8 KiB
Lua
67 lines
1.8 KiB
Lua
local T = require('toolchain')
|
|
local M = {}
|
|
local K = require('core.keymap')
|
|
|
|
function M.setup()
|
|
T.add_highlighter_autoinstalls('angular')
|
|
|
|
T.add_null_ls_module(function(null_ls)
|
|
return {
|
|
-- Diagnostics
|
|
null_ls.builtins.diagnostics.stylelint,
|
|
-- Formatter
|
|
null_ls.builtins.formatting.prettier.with({
|
|
command = 'prettierd',
|
|
}),
|
|
}
|
|
end)
|
|
|
|
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
|