-
Notifications
You must be signed in to change notification settings - Fork 200
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eglot not working with Pyright. #1224
Comments
When creating this issue, did the following text appear in front of you?
|
And I am guessing too, because I don't have an MRE. Maybe Eglot could be taught by the user not to watch certain folder with very large contents, or maybe you need to explain what the structure of your project and use |
Is this MRE? The LSP mode has this solution for the same problem. |
By golly man, did you read that link yourself? Yeah I know I did not give all that was asked (because I was confused myself) at first but what from that link in the red box is missing from the screenshot I responded with? mkdir mre
cd mre
python3 -m venv .venv
source .venv/bin/activate # maybe different depending upon the OS
pip3 install pyright numpy numpydoc
emacs test.py -Q -f toggle-debug-on-error -f eglot Does this not replicate the issue for you?
Does not look like it. I thought Emacs community was friendlier to the first time bug reporters, maybe the Node under the Pyright's hood is rubbing off. |
Not only did I read it, I wrote it. Because I don't want to write it every time I am faced with a similar difficulties.
I'm sorry you find this unfriendly. All the times it takes to you to read the information I wrote is negligible to the effort I put in writing it again and again and guessing your setup. Many other projects take a similar stance. See for example this link where I modelled some of Eglot's bug reporting practice. If this seem unfriendly to you, you should try put yourself in the shoes of a a single unpaid software maintainer of a popular package dealing with many bug reports (and still trying to have a dayjob and a non-programming-related life).
Sigh. I won't even lose time trying it until you specify what |
Yes, it usually does. Emacs and Eglot exhibit different behaviour depending on the contents of the file.
Sorry, that was in the beginning of the issue. I'd rather have a compact MRE where I don't have to scroll up and forth. You could also use
Please put in the work for following the isntructions to supply a good bug report. If you don't want to put this time, you can informally report a problem in the discussions instead. This is also stated in the text that you skipped. |
I don't see a form that I can fill out and I think being handed a shell script that literally produces the backtrace is a good bug report. I have read your instructions like 3 times and IDK what else do you want.
IDK how that clears things up any further.
mkdir mre
cd mre
python3 -m venv .venv
source .venv/bin/activate # maybe different depending upon the OS
pip3 install pyright numpy numpydoc
emacs test.py -Q -f toggle-debug-on-error -f eglot What else do you want!? Honestly, forget about it if you still don't have everything you need. |
I think I have everything, thanks.
I'm on Linux and installing all this stuff will have to be done in a container possibly, but I should find time to look at it this week. |
The If you are on Linux, likely Python 3 is installed, if it is, then Pip is installed as well. You don't need anything else. The command, |
Can't reproduce on linux. Googling brought me here: https://www.reddit.com/r/emacs/comments/x4p7mg/fix_annoying_max_open_files_for_emacs/ You could also try explaining to |
@simurgh9 when this LSP provider was added to elgot it supposed to use https://github.com/microsoft/pyright, please try to install it via npm or yarn: |
@illia-danko thanks, but I don't know if that will make a difference. I think the main problem here is that Pyright tries to watch too many files. Specifically, the files under This isn't a real problem on Linux because watching a directory with many files doesn't require many file descriptors. On MacOSX, it does and there aren't usually enough of them. What I meant by "explaining to pyright that we don't want the contents of the full hidden .venv directory watched" is that maybe there is a Pyright command-line option to achieve that. Or maybe a ticket should be raised with the server to request this. Eglot could also add code to stop watching |
Seems that this was already requested in Pyright, and the response wasn't good (IMO) microsoft/pyright#2108 (comment) I'll add a comment there asking them to reconsider |
So I thought it maybe useful to see what happens when Pyright is ran from the command-line without eglot/emacs. See above. mkdir mre
cd mre
python3 -m venv .venv
source .venv/bin/activate # maybe different depending upon the OS
pip3 install pyright numpy numpydoc
touch test.py
python3 -m pyright --watch --verbose The server complains but does not crash.
|
There is some misunderstanding here @simurgh9 . Maybe Pyright, which is an LSP server, can watch files itself, but usually servers requests clients to do the file watching on their behalf. And, as far as I can understand, that's what's happening in this case. |
To be very honest, I am not very familiar with what file watches are. I mean I could guess from the discussion over at the microsoft repo but that's about all.
I see, well but then if Pyright can watch files itself then why are we seeing the error from the client? |
I don't know for sure that it can, but your log messages seems to at least indicate that it tires to. We are seeing errors because it is also asking the client to watch a zillion files. And the client eglot uses Emacs which in turn uses Mac OSX kqueue, and that hits a limit. Thus the client answers with "internal error" and then Pyright seemingly freaks out and also kills itself. |
BTW just to avoid any miscommunication, I don't think I am on MacOS X. If I understand correctly, that is MacOS 10, (X being a roman numeral). I am on MacOS Venture 13.3.1. |
Force of habit., sorry. They dropped the X some years ago. I last used used MacOS in those versions (when it was a half-decent OS). Doesn't make a difference I think |
After analysing this and seeing there's little intention to change things over at Pyright, I can recommend the following fixes:
The latter solution seems to be much easier
You'll lose some file-watching capabilities in |
Also converting this to a discussion which is what it should have been in the first place. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
I am on MacOS Venture 13.3.1, GNU Emacs 30.0.50 (
brew install emacs-nightly
), Eglot 1.14 (found by looking ateglot.el
) and finally Pyright 1.1.307 (pip3 install pyright
).My issue is similar to this: #768
As soon as I run
eglot
, I get,Here is the
*Backtrace*
:And these are the event logs,
I tried googling the no file descriptors left error and found this,
Well, but I am not using
lsp-mode
but maybe something similar is happening with eglot?Any hint to a resolution is appreciated.
EDIT
Okay I've figured something out, this only happens when I run
eglot
from within a file that is in the same directory as a virtual environment folder, e.g.,.venv
. I am guessing that happens because emacs tries to create a watch for all the files in there. I am not sure what a good fix is though other than moving the.venv
away.The text was updated successfully, but these errors were encountered: