feat(angular): Better project detection

Since nx is not meant to only be used with angular, this will make sure
`extras/angular` only shown to the angular default + monorepo projects.
This commit is contained in:
Radvil 2024-06-12 22:22:54 +08:00
parent 46eb3242d3
commit 2fd07da9a8

View file

@ -1,9 +1,11 @@
local angular_root_pattern = { "angular.json", "project.json" }
return { return {
recommended = function() recommended = function()
return LazyVim.extras.wants({ return LazyVim.extras.wants({
root = { root = {
"angular.json", "angular.json",
"nx.json", --support for nx workspace "project.json", --support for angular monorepo workspace
}, },
}) })
end, end,
@ -31,9 +33,10 @@ return {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
opts = { opts = {
servers = { servers = {
angularls = {}, angularls = {
}, root_dir = function(root_dir)
setup = { return require("lspconfig.util").root_pattern(unpack(angular_root_pattern))(root_dir)
end,
angularls = function() angularls = function()
LazyVim.lsp.on_attach(function(client) LazyVim.lsp.on_attach(function(client)
--HACK: disable angular renaming capability due to duplicate rename popping up --HACK: disable angular renaming capability due to duplicate rename popping up