Skip to content
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

Only await LSP stop when kernel is online #1144

Merged
merged 1 commit into from
Aug 24, 2023
Merged

Conversation

jmcphers
Copy link
Collaborator

Addresses an issue noted by @lionel- in #1038.

In the cases of repeated, aggressive restarts, it is important to wait for the LSP to fully stop before attempting to start it again. It turns out that the only way to do this reliably is to wait for the stop() method to resolve (as it was before).

Therefore, we now need two codepaths -- one that we use it's safe to wait for stop() to return, and another that we use to shut down the LSP when the kernel has already exited. In both cases, we keep the new 2s timeout to keep the queue from getting blocked indefinitely.

@jmcphers jmcphers requested a review from lionel- August 23, 2023 23:10
@jmcphers jmcphers merged commit dc37b6e into main Aug 24, 2023
@wesm wesm deleted the bugfix/r-restart-lsp branch March 15, 2024 18:20
wesm pushed a commit that referenced this pull request Mar 28, 2024
Merge pull request #189 from posit-dev/feature/wait-lsp

 Sync LSP with positron-r
--------------------
Commit message for posit-dev/positron-python@bdb0b65:

Sync LSP with positron-r

This makes the necessary changes to the Python LSP to keep it in sync
with the following PRs for positron-r:

- posit-dev/ark#71
- #934
- #1144

It improves the interaction between Positron and the LSP. Instead of
Positron repeatedly trying to reconnect to the LSP server until it's
ready, now Positron waits for the server to notify it with a
`server_started` message over the LSP comm.

I also made minor changes to `lsp.py` to add more logging and
mark methods/attributes as private.

I tested repeatedly restarting with `Cmd+Shift+0` ~20 times on Python
3.8 and 3.12 as well as refreshing with `Cmd+R` and all worked well.


Authored-by: Wasim Lorgat <[email protected]>
Signed-off-by: Wasim Lorgat <[email protected]>
wesm pushed a commit that referenced this pull request Mar 28, 2024
Merge pull request #189 from posit-dev/feature/wait-lsp

 Sync LSP with positron-r
--------------------
Commit message for posit-dev/positron-python@bdb0b65:

Sync LSP with positron-r

This makes the necessary changes to the Python LSP to keep it in sync
with the following PRs for positron-r:

- posit-dev/ark#71
- #934
- #1144

It improves the interaction between Positron and the LSP. Instead of
Positron repeatedly trying to reconnect to the LSP server until it's
ready, now Positron waits for the server to notify it with a
`server_started` message over the LSP comm.

I also made minor changes to `lsp.py` to add more logging and
mark methods/attributes as private.

I tested repeatedly restarting with `Cmd+Shift+0` ~20 times on Python
3.8 and 3.12 as well as refreshing with `Cmd+R` and all worked well.


Authored-by: Wasim Lorgat <[email protected]>
Signed-off-by: Wasim Lorgat <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants