unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Elliott Shugerman <eeshugerman@gmail.com>
To: "João Távora" <joaotavora@gmail.com>, emacs-devel@gnu.org
Subject: Re: Landing feature/more-fds for Emacs 30?
Date: Sat, 25 Mar 2023 14:52:14 -0400	[thread overview]
Message-ID: <CAEb3WWY0Um42eU_+M8F-hwAXPa7_4dLr9du9c0iXF4YGjR4uMg@mail.gmail.com> (raw)
In-Reply-To: <CALDnm51kRCevuZN2=nyjkoxKk4XTxySO1c3e9BWNL-Rvz8B7Vw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4012 bytes --]

Hi João,

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 PM João Távora <joaotavora@gmail.com> wrote:

> On Mon, Mar 20, 2023 at 1:09 AM Elliott Shugerman <eeshugerman@gmail.com>
> wrote:
> >
> > Hi João,
> >
> >
> > > 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ão
>

[-- Attachment #2: Type: text/html, Size: 5485 bytes --]

      parent reply	other threads:[~2023-03-25 18:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14 16:09 Landing feature/more-fds for Emacs 30? Elliott Shugerman
2023-03-14 17:08 ` Robert Pluim
2023-03-14 19:37   ` Eli Zaretskii
2023-03-15  8:48   ` Michael Albinus
2023-03-15  9:21     ` Robert Pluim
2023-03-15  9:31       ` Michael Albinus
2023-03-15 10:22         ` Robert Pluim
2023-10-03  6:30   ` Stefan Kangas
2023-10-06 10:19     ` Robert Pluim
2023-10-06 11:23       ` Stefan Kangas
2023-10-06 11:52         ` Robert Pluim
2023-10-06 12:13         ` Eli Zaretskii
2023-03-15 17:12 ` João Távora
2023-03-15 17:37   ` Robert Pluim
2023-03-15 18:02     ` João Távora
     [not found]       ` <CAEb3WWaQM8NskPUqX1S2L_ampAZmv+X+8CwKTxc9urD1rhfexg@mail.gmail.com>
     [not found]         ` <CALDnm51kRCevuZN2=nyjkoxKk4XTxySO1c3e9BWNL-Rvz8B7Vw@mail.gmail.com>
2023-03-25 18:52           ` Elliott Shugerman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEb3WWY0Um42eU_+M8F-hwAXPa7_4dLr9du9c0iXF4YGjR4uMg@mail.gmail.com \
    --to=eeshugerman@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=joaotavora@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).