Skip to content

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