From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#41955: 28.0.50; Monorepos and project.el Date: Sun, 21 Jun 2020 04:48:09 +0300 Message-ID: <1d3ed076-692f-b6e2-2fb3-83593561e33a@yandex.ru> References: <87pn9un5xu.fsf@thornhill.no> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="64801"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 Cc: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= To: Theodor Thornhill , 41955@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 21 03:49: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 1jmp6n-000Glg-Bu for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 21 Jun 2020 03:49:21 +0200 Original-Received: from localhost ([::1]:56810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jmp6l-000541-VO for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Jun 2020 21:49:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jmp6U-00053S-Cg for bug-gnu-emacs@gnu.org; Sat, 20 Jun 2020 21:49:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jmp6U-000810-3O for bug-gnu-emacs@gnu.org; Sat, 20 Jun 2020 21:49:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jmp6U-0004yn-1S for bug-gnu-emacs@gnu.org; Sat, 20 Jun 2020 21:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 21 Jun 2020 01:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41955 X-GNU-PR-Package: emacs Original-Received: via spool by 41955-submit@debbugs.gnu.org id=B41955.159270410019088 (code B ref 41955); Sun, 21 Jun 2020 01:49:01 +0000 Original-Received: (at 41955) by debbugs.gnu.org; 21 Jun 2020 01:48:20 +0000 Original-Received: from localhost ([127.0.0.1]:59025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jmp5o-0004xo-DG for submit@debbugs.gnu.org; Sat, 20 Jun 2020 21:48:20 -0400 Original-Received: from mail-wr1-f47.google.com ([209.85.221.47]:34240) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jmp5m-0004xb-B0 for 41955@debbugs.gnu.org; Sat, 20 Jun 2020 21:48:18 -0400 Original-Received: by mail-wr1-f47.google.com with SMTP id v3so5812042wrc.1 for <41955@debbugs.gnu.org>; Sat, 20 Jun 2020 18:48:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=tENW+FSZ3HE+SSX5zHhF9bWZalB1ddMeLs0DFt6qLhI=; b=LJM7tYjJiVFdXf6fzbqnOzg94bsctZy19L8d8Nk/6P8FPgRYtE7kn76Trx47o131vN +r1OcZ1ir4tnNQBx1LZvs4nJBiOh21oCneaTqE/CdfYa4Ue7ogsJk+pJi+mOLeicdfKv KM8fICGiVgEIr4WEYZ+zipPQP9hh+A2l8z4YQFs22LuSxDKcf/cfue2okKPqyqTjzEBb jQQxWVCf51LpgDzEToDXQyOg//M+fb6+8EUulDMf/S7cJlMCFUy7oIXV8QLWDTzYT1DZ 7A5NeghBVxPGwXAnYWr7S4Tr4Wc+V6Ey9wDJeJMD0ScslZIxLRSbJuLX4cIB8QxLgQLs NWLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=tENW+FSZ3HE+SSX5zHhF9bWZalB1ddMeLs0DFt6qLhI=; b=YLnxQDmNTts16QqoOoWPiRFhnq6E1R42GiHz9Ffm1gA7IDCceni5rrSN5N1ReOrq6T Y71jtOfWUf3v6QtOZMGV1NpLs7vGTPPRMZJ7faABDuh0WbtoiU2z4+ktAoCohkRWJLE7 YV5Gk7EHoUojsitKR5YKrO52Mc2TacRmcY6znBT+OueAHt2gfu3cZmrVB1OZ7JYz/VcF HEvEddc3na0tW0HMDHJSqbS3PO/fWZEM7+w1nPphbD/hA/fC0yDz3nPu0s5spXmpZ/S4 I1JL72AwlDoeBJ4t/9lVbFMUv2avTmmIOLTqo5WSXXrO778PXCAXJqCNEIgbb/ETKk8n K+jQ== X-Gm-Message-State: AOAM532hWpQ6x1bOOf4++puokRKCUOB6WZrENoWT39mu+M+iuo/bdz03 IC5aOaG3BFGUo/LMRK7Vw0o= X-Google-Smtp-Source: ABdhPJxGtaWSUumGvX/x1yH26eIdFipmIbSf7pgpLRfH+HL7PtslmVOynlp/VAL6+ZjPmspGgJtfjw== X-Received: by 2002:adf:8287:: with SMTP id 7mr12331641wrc.124.1592704092361; Sat, 20 Jun 2020 18:48:12 -0700 (PDT) Original-Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id i19sm4938716wrb.56.2020.06.20.18.48.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 20 Jun 2020 18:48:11 -0700 (PDT) In-Reply-To: <87pn9un5xu.fsf@thornhill.no> Content-Language: en-US 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:182232 Archived-At: On 19.06.2020 23:42, Theodor Thornhill wrote: > At work I've had the following issue. Assume we have some sort of > gigarepo, like this maybe: > > gigarepo/ > ├── clients > │   ├── client1 > │   ├── client2 > │   ├── client3 > │   └── client4 > └── services > ├── service1 > ├── service2 > ├── service3 > └── 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. Thank you for the report and the description. Before moving on to more complete solutions, here are some initial comments: > * 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.) I think Eglot is wrong in simply defaulting to project-root, without looking for tsconfig.json, etc. It would be pretty easy to implement, and would bring it closer to VS Code's behavior in this aspect (I think). But that would require it to maintain a list of such files. > * 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. Uniquify should help, but yeah, it sounds like a pain point indeed. > * 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. This is just a small step, but have you tried the patch here (with rg)? https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00547.html > 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. Here's some code based on yours. Also rough and unofficial, but should hopefully be faster. (defvar project-root-markers '("package.json" "tsconfig.json" "jsconfig.json" "elm.json" "*.sln") "Files or directories that indicate the root of a project.") ;; Probably better in .dir-locals.el. (setq project-vc-ignores '("node_modules" "target" "build" "package-lock.json" "elm-stuff")) (defun project-find-nomono (dir) (let ((root (locate-dominating-file dir (lambda (d) (let ((default-directory d)) (seq-some #'file-expand-wildcards project-root-markers)))))) (when (and root (ignore-errors (vc-responsible-backend root))) (cons 'vc root)))) (add-hook 'project-find-functions #'project-find-nomono)