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

Presentation compiler: diagnostic provider #22259

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

rochala
Copy link
Contributor

@rochala rochala commented Dec 22, 2024

Adds a capability to provide instant diagnostics for the opened buffers with almost 0 cost.

This can be utilised by tools, such as metals or Scastie, to provide diagnostics without saving a buffer and relying on build server to provide them.

It also publishes warnings and code actions if they are present.

One important bit is that the diagnostics are a subset of build server diagnostics, because presentation compiler runs only phases until typer, thus any diagnostic emitted in later phases will not be published. This should be a minimal problem as most issues come from Typer phase.

In the future, we should experiment with other phases such as CheckUnused to provide unused diagnostics along with quick fixes. This is a very powerful addition, as we can then try to reimplement remaining features such as organise imports, to not rely on Scalafix to do it and operate directly on compiler diagnostics. This will have to be well tested, as any extra phase added to the InteractiveCompiler will slow down all other features that rely on it such as hovers, completions etc, so this is basically a tradeoff.

Screencast is more than 1000 words.

Screen.Recording.2024-12-22.at.12.56.06-1.mov

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.

1 participant