bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60570: 29.0.60; Eglot+pyright freeze Emacs when edit a single file i


From: João Távora
Subject: bug#60570: 29.0.60; Eglot+pyright freeze Emacs when edit a single file in Home director
Date: Thu, 5 Jan 2023 21:38:40 +0000

Eason,

Eglot is asking project.el to tell it which files belong to a
project. I believe project.el uses find as a last-ditch effort, if 
finds no other method to answer.

I'm afraid there can be no good solution to your problem, because by
invoking any project-aware operation on ~/test.py (and Eglot counts as
project-aware functionality) and in the absence of, say, a ~/.git you
are effectively telling `project.el` that your whole home directory is a
gigantic project, and there is no good way to determine the files in
that project but to use find.

You could:

1. configure your language server to not request project-wide file
   watching from the LSP client in certain directories (including the
   $HOME directory).  See your language server's documentation for this
   effect

2. Tell project.el via its interfaces (project-find-functions) that the
   "project" you store in your $HOME is composed of a relatively small and
   manageable set of files.

3. A very simple means -- but not the only means -- to do the above is to
   type `git init` in your $HOME directory.

4. Read project.el's documentation (and ask its maintainers) for other
   means to use project-find-functions to declare that a project exists
   in $HOME but does not include the full contents of your home
   directory as its files.

5. Stop opening Python scripts in your $HOME *and* auto-activating Eglot
   in them.  You may be auto-activating Eglot with eglot-ensure, but this
   is not recommended precisely because it carries with risks like this.

6. Request to project.el's maintainer that project.el interrupt up its
   very slow `find`-based search and returns only subset of results.

7. Request that Eglot honour the keyword didChangeWatchFiles when it is
   included in eglot-ignored-server-capabilities.  If you then also
   change your configuration to do this _only_ in certain directories
   (for example by utilizing directory-local variables or writing a
   slightly complicated whook), this would mitigate your problem. We
   can probably do this in eglot.el, but I don't see this as priority
   because of the burden on the user and it only solves the problem for
   Eglot, not all other project.el-using functionality.

I recommend restricting your use of eglot-ensure. It's very overrated
functionality. M-x eglot will probably only need to be typed once 
or twice in a typical Emacs session.

You can also, possibly, "unfreeze" your emacs by using C-g or a killall
find issued from the console.

João

reply via email to

[Prev in Thread] Current Thread [Next in Thread]