
This was previously attemped to be fixed by https://github.com/LazyVim/LazyVim/pull/3469, which caused an issue with angular LSP. The PR was reverted as mentioned in https://github.com/LazyVim/LazyVim/pull/3485. This PR implements suggestion by @folke, which fixes treesitter without breaking LSP.
63 lines
1.6 KiB
Lua
63 lines
1.6 KiB
Lua
return {
|
|
recommended = function()
|
|
return LazyVim.extras.wants({
|
|
root = {
|
|
"angular.json",
|
|
"nx.json", --support for nx workspace
|
|
},
|
|
})
|
|
end,
|
|
|
|
{
|
|
"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("BufRead", {
|
|
pattern = { "*.component.html", "*.container.html" },
|
|
callback = function()
|
|
vim.treesitter.start(nil, "angular")
|
|
end,
|
|
})
|
|
end,
|
|
},
|
|
|
|
-- angularls depends on typescript
|
|
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
|
|
|
-- LSP Servers
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
opts = {
|
|
servers = {
|
|
angularls = {},
|
|
},
|
|
setup = {
|
|
angularls = function()
|
|
LazyVim.lsp.on_attach(function(client)
|
|
if client.name == "angularls" then
|
|
--HACK: disable angular renaming capability due to duplicate rename popping up
|
|
client.server_capabilities.renameProvider = false
|
|
end
|
|
end)
|
|
end,
|
|
},
|
|
},
|
|
},
|
|
|
|
-- Configure tsserver plugin
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
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,
|
|
},
|
|
}
|