From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Theodor Thornhill Newsgroups: gmane.emacs.bugs Subject: bug#41955: 28.0.50; Monorepos and project.el Date: Fri, 19 Jun 2020 20:42:26 +0000 Message-ID: <87pn9un5xu.fsf@thornhill.no> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="61110"; mail-complaints-to="usenet@ciao.gmane.io" To: 41955@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 19 22:43:21 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jmNr7-000Fmr-0X for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 Jun 2020 22:43:21 +0200 Original-Received: from localhost ([::1]:41748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jmNr5-0008OR-U4 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 Jun 2020 16:43:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jmNqo-0008OI-88 for bug-gnu-emacs@gnu.org; Fri, 19 Jun 2020 16:43:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45365) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jmNqn-00074B-Uj for bug-gnu-emacs@gnu.org; Fri, 19 Jun 2020 16:43:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jmNqn-0002Ke-RY for bug-gnu-emacs@gnu.org; Fri, 19 Jun 2020 16:43:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Jun 2020 20:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41955 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15925993598930 (code B ref -1); Fri, 19 Jun 2020 20:43:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Jun 2020 20:42:39 +0000 Original-Received: from localhost ([127.0.0.1]:56911 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jmNqQ-0002Jy-Sf for submit@debbugs.gnu.org; Fri, 19 Jun 2020 16:42:39 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:40440) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jmNqP-0002Jq-En for submit@debbugs.gnu.org; Fri, 19 Jun 2020 16:42:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jmNqO-0008MY-Oo for bug-gnu-emacs@gnu.org; Fri, 19 Jun 2020 16:42:37 -0400 Original-Received: from mail-40134.protonmail.ch ([185.70.40.134]:34117) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jmNqL-00071c-Qd for bug-gnu-emacs@gnu.org; Fri, 19 Jun 2020 16:42:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=protonmail; t=1592599350; bh=hEw1irZnT4c/KeGMMOvoEidZkl6UezmxeBIKAHv+xi0=; h=Date:To:From:Reply-To:Subject:From; b=dk4H38BOAVQh4T6ZfOItSgExWj2Vr5AvqzPArp4WEl5PSlI6rhrW64v6Y/MOchysY Lby08kskX/Papp3Ccm3u8uuSe97cIJRvsDWRtgOIrEUGL7mcifiSBBf7UoPS9yDVU6 pcCUMurNM+YFi8bzsDNYa/sxFEtcakNZHVd2VHXFhMu9XDUJcZocxnCF9F31mPfWgR zYQNcfSS3X8I4sjcMKJ6eCNDxFAoU6U8Ph0PVZatQtB5BJvyLHc6lfRJNfiarKfEYX aBkJvA3J9zh06MxvCdCDxbDH74QU9IkNW+EOEsm8d1hxs1wwTFvM9WVrPqRQf57izU mwaCX+wMGBxfw== Received-SPF: pass client-ip=185.70.40.134; envelope-from=theo@thornhill.no; helo=mail-40134.protonmail.ch X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/19 16:42:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:182186 Archived-At: Hi! At work I've had the following issue. Assume we have some sort of gigarepo, like this maybe: gigarepo/ =E2=94=9C=E2=94=80=E2=94=80 clients =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 client1 =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 client2 =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 client3 =E2=94=82=C2=A0=C2=A0 =E2=94=94=E2=94=80=E2=94=80 client4 =E2=94=94=E2=94=80=E2=94=80 services =E2=94=9C=E2=94=80=E2=94=80 service1 =E2=94=9C=E2=94=80=E2=94=80 service2 =E2=94=9C=E2=94=80=E2=94=80 service3 =E2=94=94=E2=94=80=E2=94=80 service4 The services are made in different languages, say, some in c#, f#, java - as are clients, some are Typescript projects, some are JS etc etc. Everything is rooted in a ".git" in "gigarepo/", and there are no submodules or any fancyness. As project.el works now, there are several issues arising. I'll just note them down here, and probably split things up later, if that is ok. * Lsp server/client In most of the projects, the lsp servers are indexing from what they consider root. Typically a tsconfig.json, elm.json etc. They get confused, eglot a bit more than lsp-mode (it has its own root finding algorithm). What happens is they look in root (gigarepo/), and it has no executable for lsp-server. One solution is then to install the server in root, but then it indexes the whole thing, and gets super slow, and indexes a lot of unrelated stuff (I'm not even working on client 2-4.) =20 * Buffer switching Lets say several of the clients uses a module called AuthService.ts. If I'm working on several of these projects you get a lot of identical files, so it is a bit hit and miss. =20 * Grepping This one was the worst for me, since grepping was very slow given the size of the project, and grepping loads of unrelated files returns a lot of noise.=20 What would be nice is to be able to get the benefits of the vc-dir version of project.el, but not having to "git init" inside the child projects. More specifically, to be able to choose "project context", one as the closest project-root and one as the gigarepo project-root. Also, If I've worked on both a service and a client, running git or magit should probably be done from root rather than the subproject I am currently in, to get the whole context. Is there a way to do this? I realize this may be an odd situation, but it came up nonetheless. This report is getting long, and I think I'm already rambling a bit (and forgetting stuff.), so I'll leave it for now. Theo P.S: What I did to circumvent this (this is only a MVP, not at all optimized for anything): (defvar project-root-markers '("package.json" "tsconfig.json" "jsconfig.json" "elm.json" "*.sln") "Files or directories that indicate the root of a project.") (defvar project-exclusion-list '("node_modules" "target" "build" "package-lock.json" "elm-stuff") "Things not to be included in project-find-file.") (defun project-exclude-dirs () (mapcar (lambda (dir) (add-to-list 'vc-directory-exclusion-list dir)) project-exclusion-list)) (defun project-find-root (path) "Tail-recursive search in PATH for root markers." (let* ((this-dir (file-name-as-directory (file-truename path))) (parent-dir (expand-file-name (concat this-dir "../"))) (system-root-dir (expand-file-name "/"))) (cond ((project-root-p this-dir) (cons 'transient this-dir)) ((equal system-root-dir this-dir) nil) (t (project-find-root parent-dir))))) (defun project-root-p (path) "Check if current PATH has any of project root markers." (let ((results (mapcar (lambda (marker) (file-exists-p (concat path marker))) project-root-markers))) (eval `(or ,@ results))))