-
Notifications
You must be signed in to change notification settings - Fork 13
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
Pyright doesn't work anymore for unsaved buffers #281
Comments
xxx.mp4I can see But then |
I noticed that pyright doesn't response to May related to microsoft/pyright#6314 I can see pyright immediately takes 100% CPU of a core, only if the server process is invoked by a unsaved buffer. |
I assume that it must be a server bug. It's not just the shutdown request, there are no more responses to any request and it doesn't send I looked at a few commits in pyright between 1.1.332 and 1.1.333, and this one might be a possible cause because it seems to affect URI handling: microsoft/pyright@cfe56bf (just speculation). Perhaps something breaks for the Yeah, your linked issue looks like it is related. |
VSCode's Pylance and Pyright extension doesn't suffer from 100% CPU (with unsaved buffer). |
It was never able to return from this loop: https://github.com/microsoft/pyright/blob/a95a808e580f81bad6f35196b784b6b6fe13d8f7/packages/pyright-internal/src/analyzer/importResolver.ts#L508-L587 The |
While it's fine to remove the
The URIs for "View Package File" look like Even with the PR merged I can still reproduce the server "dying" with the example from sublimelsp/LSP#2360 (comment). It happens right when you type So I guess this issue could be reopened, and for now I would suggest to remove the "buffer" in
|
Pyright does something to the effect of file traversing that walks "up the tree" that causes this issue. Though not sure why would it do that for non-file URIs. Best to file an issue with it. |
Wait, actually I wonder whether those are really valid URIs. I think https://datatracker.ietf.org/doc/html/rfc3986#section-3.3
|
Good point.
( That doesn't make the URI invalid, I don't think. It's just that the view id is parsed as So we could switch to Note that vscode uses |
We can use "buffer" in plugin settings, but sents "untitled:foo" under the hood. Or deprecates "buffer" and introduces "untitled". |
Ah, you're right, the path is empty in this case and the I would keep the
Perhaps this already fixes the bug with unsaved buffers in pyright. I'm unsure about the
But on the other hand ST seems to already use |
See #281 Signed-off-by: Jack Cherng <[email protected]>
Done, with a release tagged. |
Hi all, just want to know this is a pyright issue or a LSP issue (or both? or unclear yet?). Pyright's maintainer is asking for a "100% CPU consumption" reproduction on microsoft/pyright#6314 (comment) |
This seems to be fixed in the latest pyright pyright 1.1.337 (without LSP's change). |
In the release notes, I see:
|
It seems that LSP-pyright is now broken for unsafed buffers, for which the server is enabled by default. After you created such an unsafed buffer, the server simply doesn't respond to requests anymore, both for the
buffer
scheme and also for regular files, until it is restarted. It looks like as if an internal crash happend in the server.https://github.com/sublimelsp/LSP-pyright/releases/tag/1.2.52 (pyright 1.1.333) seems to be the first affected version.
The text was updated successfully, but these errors were encountered: