1
0
Fork 1
Dotfiles_nvim/lua/toolchain/angular.lua

68 lines
1.8 KiB
Lua
Raw Normal View History

2024-12-15 05:34:42 +00:00
local T = require('toolchain')
local M = {}
2024-12-18 19:35:52 +00:00
local K = require('core.keymap')
2024-12-15 05:34:42 +00:00
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)
2024-12-18 19:35:52 +00:00
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,
})
2024-12-15 05:34:42 +00:00
end)
T.add_plugins({
'joeveiga/ng.nvim',
config = function()
local ng = require('ng')
vim.keymap.set(
2024-12-18 19:35:52 +00:00
K.ANGULAR.COMPONENT.mode,
K.ANGULAR.COMPONENT.shortcut,
ng.goto_component_with_template_file,
{
noremap = true,
silent = true,
desc = K.ANGULAR.COMPONENT.description,
}
2024-12-15 05:34:42 +00:00
)
vim.keymap.set(
2024-12-18 19:35:52 +00:00
K.ANGULAR.TEMPLATE.mode,
K.ANGULAR.TEMPLATE.shortcut,
ng.goto_template_for_component,
{
noremap = true,
silent = true,
desc = K.ANGULAR.TEMPLATE.description,
}
2024-12-15 05:34:42 +00:00
)
end,
})
end
return M