posit-dev / posit-dev/ark

Improve lifecycle management of LSP

Open
#622 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
337
Forks
32
Avg merge
8d 17h
Merged PRs (30d)
11

Description

@lionel- and I were looking at the LSP lifecycle a little more and realized that when the tower-lsp server exits here:

https://github.com/posit-dev/ark/blob/b8505c504eb10be0e9cb948e1631f151825facdb/crates/ark/src/lsp/backend.rs#L427

we should also unset the events channel in RMain that we sent it here:

https://github.com/posit-dev/ark/blob/b8505c504eb10be0e9cb948e1631f151825facdb/crates/ark/src/lsp/backend.rs#L397-L403

because there is no longer anything it can send messages to.

The tower-lsp server will exit like this during a Positron developer refresh, so it is a decently common case. I think it is possible for us to get in a bad place if we don't clear the RMain sender.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in crates/ark/src/lsp/backend.rs at the server setup around lines 397-403 and exit handling around line 427. Trace how the events channel is stored in RMain and how the tower-lsp server exits during a developer refresh. Done means the RMain channel is cleared when the server exits, with the existing lifecycle behavior preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.