From 2fd07da9a826eaaee1a62ba49349221527f1ce01 Mon Sep 17 00:00:00 2001 From: Radvil Date: Wed, 12 Jun 2024 22:22:54 +0800 Subject: [PATCH] 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. --- lua/lazyvim/plugins/extras/lang/angular.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/angular.lua b/lua/lazyvim/plugins/extras/lang/angular.lua index f039c3a0..3e2b455b 100644 --- a/lua/lazyvim/plugins/extras/lang/angular.lua +++ b/lua/lazyvim/plugins/extras/lang/angular.lua @@ -1,9 +1,11 @@ +local angular_root_pattern = { "angular.json", "project.json" } + return { recommended = function() return LazyVim.extras.wants({ root = { "angular.json", - "nx.json", --support for nx workspace + "project.json", --support for angular monorepo workspace }, }) end, @@ -31,9 +33,10 @@ return { "neovim/nvim-lspconfig", opts = { servers = { - angularls = {}, - }, - setup = { + angularls = { + root_dir = function(root_dir) + return require("lspconfig.util").root_pattern(unpack(angular_root_pattern))(root_dir) + end, angularls = function() LazyVim.lsp.on_attach(function(client) --HACK: disable angular renaming capability due to duplicate rename popping up