From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Elliott Shugerman Newsgroups: gmane.emacs.devel Subject: Re: Landing feature/more-fds for Emacs 30? Date: Sat, 25 Mar 2023 14:52:14 -0400 Message-ID: References: <87wn3hud8z.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000be57a405f7be02a1" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5824"; mail-complaints-to="usenet@ciao.gmane.io" To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Mar 25 19:53:07 2023 Return-path: Envelope-to: ged-emacs-devel@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 1pg90l-0001Ha-Fc for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Mar 2023 19:53:07 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pg90H-00009L-EM; Sat, 25 Mar 2023 14:52:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pg90E-00008v-Uq for emacs-devel@gnu.org; Sat, 25 Mar 2023 14:52:34 -0400 Original-Received: from mail-ua1-x935.google.com ([2607:f8b0:4864:20::935]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pg909-00018a-6Z for emacs-devel@gnu.org; Sat, 25 Mar 2023 14:52:31 -0400 Original-Received: by mail-ua1-x935.google.com with SMTP id r7so3660798uaj.2 for ; Sat, 25 Mar 2023 11:52:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679770345; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=XAKgQx9UsoeFkP6iuYxH3tbhye0fJCSnY6MdBM91t2c=; b=OulaXFCMyv/insvEi2J3Or2aDX2oi1WaV14U5aOqvlXLPmz5WkC9qadBOPksGgyTFd 4aPrir9GVTAI3z4fMlKAfZFkSnAusUdVEwcIGmNfqBM7R9z3JO7awb7aUetegVfwQS17 0b78ZNLwE0UIXScgUP3s4F8EWHuVXnVFYiQ3OnX56cBHHJum0lstTjH+BPIoAs52a096 UBjbnKPj2UT2Lt2onG9SFUjwXQEaLZsIgNEY55xXWR4EoatXNzO/PZDnaY2H8JXas9Fn cgVKm0D8/PxvCV2e5U7QRBtFHtOMxdSaBXp46epPr1U6BviMDcWKHjEZBoYRYVX/n52b kFuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679770345; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XAKgQx9UsoeFkP6iuYxH3tbhye0fJCSnY6MdBM91t2c=; b=6cOO9WqYvKACYBoPbALmQ7raQJtGaHhu33K7YvRet13zs/V9b+Jp23N8ojBp7OSWl/ AbU0yHrumJQauV6TA0/5ti29elccdYgVsnk5P/48kiKlY1UkQ6WIMxLJURESvXRyz/E7 YVhZIA8fbf0c5EuUDNQXSoADhO58Dccob3UOOZCRAtfEz7A+GB8/d5/ugTYfJaDYwzv6 6b3GuIBh4+xEiorNrAyPbaNDni9eXAhCil6kMetSqHJCbZGr4YEkuP6/HaZna22PUghA jQuyG1IkP7u6Aj+n17c7afDAQk1Q5Q3NVA4Xc/UHVWNKeT2I4riPEs+nkTsVNOhu4flP yTLw== X-Gm-Message-State: AAQBX9dlon5E+INHpdKOvKPYLojlCsYP44C+WyiWNWemc2MXGd76ONJY yOBAkcr//UsZNkKa2dvuT2sYt7O2HJy42MPDLfU= X-Google-Smtp-Source: AKy350ab8Q6C6UccKvHXi9TVYJh7KfG4oX4ysEewrqVRYzOde81NnUO7MaTxEPY5dErJ9paxlOi7VeZWYPDNapV2fLU= X-Received: by 2002:a05:6130:2a9:b0:68a:5c52:7f2b with SMTP id q41-20020a05613002a900b0068a5c527f2bmr4670384uac.1.1679770345427; Sat, 25 Mar 2023 11:52:25 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::935; envelope-from=eeshugerman@gmail.com; helo=mail-ua1-x935.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304768 Archived-At: --000000000000be57a405f7be02a1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Jo=C3=A3o, Thanks for your interest in this issue and apologies for my slow replies. > > I always figured the purpose of these watchers is to account for switching git branches and the like, which is functionality I appreciate, FWIW. > I'm not sure I understand what you mean. In rust-analyzer, for > example, it watches the Cargo file (similar to a Makefile) to > know if you're adding new libraries to it, that the language > server must link and compile. To know if a git branch has been > switched, the server need to watch only one or two files under .git. Sorry I wasn't very clear. The functionality I was alluding to is not specific to Git, it goes for any changes to project files that are not visited by buffers in Emacs. Example: - I have a single source file, "A", open in an Emacs buffer. The flycheck icon in my modeline is green, indicating no LSP errors in the buffer (I have lsp-mode/flycheck integration configured). - Now, by some means outside Emacs -- a git or sed command, say -- I make a change to source file "B", which is not visited by an Emacs buffer, in such a way that there is now a type error in buffer "A" (maybe I've added a method to an interface). - Momentarily, I see the flycheck icon in my modeline turn red. I assume it's to support this kind of magic that lsp-mode watches so many files (all .ts files in the project, I believe). However I just tried this with lsp-mode + rust-analyzer, and it doesn't seem to work there -- I have restart the server for the icon to turn red . But it does work with lsp-mode + typescript-language-server. So maybe it's the server watching the source files after all? Best, Elliott On Sun, Mar 19, 2023 at 9:17=E2=80=AFPM Jo=C3=A3o T=C3=A1vora wrote: > On Mon, Mar 20, 2023 at 1:09=E2=80=AFAM Elliott Shugerman > wrote: > > > > Hi Jo=C3=A3o, > > > > > > > What LSP server are you using? > > > > typescript-language-server (ts-ls) > > > > > Is it perhaps requesting many file watchers? > > > > I don't know but are you suggesting the "too many open files" in Emacs > is related to some global OS limit? I don't _think_ that's the case as > other apps remain stable when I run into this, it's only Emacs starts > acting up, but I could be wrong. > > No, I'm not suggesting that. > > Servers like to watch files to known about things like build system > changes and preferences in advance, by means of interfaces that LSP > itself doesn't give them. I was merely conjecturing that the server > could be overzealous and watching files that really don't matter that > much, like watching all the files in a directory when it really > only needs one file to know what it wants to know. > > > > Or maybe the client is overwatching on the Emacs side (what client > are you using?). > > > > I'm using lsp-mode > > If you have the possibility, give Eglot ago. It's in the > Emacs 29 pretests. Once you have it working with M-x > eglot stably, turn off event logging (which is on be default) > This will reduce the memory footprint dramatically and > improve performance, > > > > Do you have a JSONRPC transcript that you can share with me? > > > > I don't know, where would I find or generate this? > > I wouldn't know in lsp-mode. In Eglot it's M-x eglot-events-buffer. > > > > > > Maybe, depending on the use case, it makes sense to only watch files > on behalf of the LSP that Emacs is actually visiting. > > > > I always figured the purpose of these watchers is to account for > switching git branches and the like, which is functionality I appreciate, > FWIW. > > I'm not sure I understand what you mean. In rust-analyzer, for > example, it watches the Cargo file (similar to a Makefile) to > know if you're adding new libraries to it, that the language > server must link and compile. To know if a git branch has been > switched, the server need to watch only one or two files under .git. > > Jo=C3=A3o > --000000000000be57a405f7be02a1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Jo=C3=A3o,

Thanks for you= r interest in this issue and apologies for my slow replies.

&g= t; > I always figured the purpose of these watchers is=20 to account for switching git branches and the like, which is=20 functionality I appreciate, FWIW.
> I'm not sure I understand what you mean.=C2=A0 In rust-analyzer, f= or
> example, it watches the Cargo file (similar to a Makefile) to
> know if you're adding new libraries to it, that the language
> server must link and compile.=C2=A0 To know if a git branch has been > switched, the server need to watch only one or two files under .git.

Sorry I wasn't very clear. The f= unctionality I was alluding to is not specific to Git, it goes for any chan= ges to project files that are not visited by buffers in Emacs.
Example:
- I have a single source file, "A", open in an Emacs= buffer. The flycheck icon in my modeline is green, indicating no LSP error= s in the buffer (I have lsp-mode/flycheck in= tegration configured).
- Now, by some means outside Emacs -- a git or sed comm= and, say -- I make a change to source file "B", which is not visi= ted by an Emacs buffer, in such a way that there is now a type error in buf= fer "A" (maybe I've added a method to an interface).
- Momentarily, I see the flycheck icon= in my modeline turn red.

I assume it's to support this kind of = magic that lsp-mode watches so many files (all .ts files in the project, I = believe).

However I just tried this with lsp-mode + rust-analyzer= , and it doesn't seem to work there -- I have restart the server for th= e icon to turn red . But it does work with lsp-mode + typescript-language-s= erver. So maybe it's the server watching the source files after all?

Best,
Elliott




On= Sun, Mar 19, 2023 at 9:17=E2=80=AFPM Jo=C3=A3o T=C3=A1vora <joaotavora@gmail.com>= wrote:
On Mon, = Mar 20, 2023 at 1:09=E2=80=AFAM Elliott Shugerman <eeshugerman@gmail.com> wrote:<= br> >
> Hi Jo=C3=A3o,
>
>
> > What LSP server are you using?
>
> typescript-language-server (ts-ls)
>
> > Is it perhaps requesting many file watchers?
>
> I don't know but are you suggesting the "too many open files&= quot; in Emacs is related to some global OS limit? I don't _think_ that= 's the case as other apps remain stable when I run into this, it's = only Emacs starts acting up, but I could be wrong.

No, I'm not suggesting that.

Servers like to watch files to known about things like build system
changes and preferences in advance, by means of interfaces that LSP
itself doesn't give them.=C2=A0 I was merely conjecturing that the serv= er
could be overzealous and watching files that really don't matter that much, like watching all the files in a directory when it really
only needs one file to know what it wants to know.

>=C2=A0 > Or maybe the client is overwatching on the Emacs side (what= client are you using?).
>
> I'm using lsp-mode

If you have the possibility, give Eglot ago.=C2=A0 It's in the
Emacs 29 pretests.=C2=A0 Once you have it working with M-x
eglot stably, turn off event logging (which is on be default)
This will reduce the memory footprint dramatically and
improve performance,

> > Do you have a JSONRPC transcript that you can share with me?
>
> I don't know, where would I find or generate this?

I wouldn't know in lsp-mode.=C2=A0 In Eglot it's M-x eglot-events-b= uffer.

>
> > Maybe, depending on the use case, it makes sense to only watch fi= les on behalf of the LSP that Emacs is actually visiting.
>
> I always figured the purpose of these watchers is to account for switc= hing git branches and the like, which is functionality I appreciate, FWIW.<= br>
I'm not sure I understand what you mean.=C2=A0 In rust-analyzer, for example, it watches the Cargo file (similar to a Makefile) to
know if you're adding new libraries to it, that the language
server must link and compile.=C2=A0 To know if a git branch has been
switched, the server need to watch only one or two files under .git.

Jo=C3=A3o
--000000000000be57a405f7be02a1--