Skip to main content

Angular

info

You can enable the extra with the :LazyExtras command. Plugins marked as optional will only be configured if they are installed.

Below you can find a list of included plugins and their default settings.

caution

You don't need to copy the default settings to your config. They are only shown here for reference.

Includes the following extras

nvim-treesitter

opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "angular", "scss" })
end
vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
pattern = { "*.component.html", "*.container.html" },
callback = function()
vim.treesitter.start(nil, "angular")
end,
})
end

nvim-lspconfig

LSP Servers

opts = {
servers = {
angularls = {},
},
setup = {
angularls = function()
LazyVim.lsp.on_attach(function(client)
--HACK: disable angular renaming capability due to duplicate rename popping up
client.server_capabilities.renameProvider = false
end, "angularls")
end,
},
}

nvim-lspconfig

Configure tsserver plugin

opts = function(_, opts)
LazyVim.extend(opts.servers.vtsls, "settings.vtsls.tsserver.globalPlugins", {
{
name = "@angular/language-server",
location = LazyVim.get_pkg_path("angular-language-server", "/node_modules/@angular/language-server"),
enableForWorkspaceTypeScriptVersions = false,
},
})
end

conform.nvim

formatting

opts = function(_, opts)
if LazyVim.has_extra("formatting.prettier") then
opts.formatters_by_ft = opts.formatters_by_ft or {}
opts.formatters_by_ft.htmlangular = { "prettier" }
end
end