rust-lang / rust-lang/rust-analyzer

Redesign `rust-analyzer::flycheck`

Open
#18,186 2 comments 1 reaction 1 assignee View on GitHub

@alibektas is already working on this.

Since Sep 25, 2024.

A-flycheck
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

The current implementation of flycheck is flawed in that it instantiates at most a single "flycheck instance" for each workspace. With the introduction of rust-analyzer.toml files, more fine-grained configuration has become possible. Therefore, we need more flexibility in flycheck instances. At the same time, we want to avoid having many `flycheck' threads, as this is clearly inefficient.

Another issue that also needs to be addressed is how hard it is to test any kind of flycheck activity. The new model should make testing less of a problem for us.

Some key points about the new approach

  • A thread pool will be used to avoid unnecessary initialization/destruction of threads. The number of threads will be configurable.
  • Threads are used to execute whatever flycheck op is waiting to be executed. To map the results of a flycheck' instance to the corresponding workspace, it was previously sufficient to keep a workspace id'. The new model could use a hash of workspace_id * target * other things I can't think of to compute an id.
  • More points to come in the next few days.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.