Replies: 3 comments 3 replies
-
One other thing I'm thinking about is what exactly to do with |
Beta Was this translation helpful? Give feedback.
-
As long as we can maintain forward and backward compatibility, I think it would be great to get necessary data in to One thing I'd watch out for is the potential for increased memory, storage, and network usage whenever we add information to something that's used fairly common. UpdateReportAt some point in 2014 I realized that sbt was throwing away the details of dependency resolution like license and caller info, since they aren't needed to calculate classpath. I thought we can mine interesting thing about of that and expanded it in 855e7f1 as part of a PR to implement eviction report. As it turned out, eviction warning was kind of interesting, but not all that effective, but the performance penalty of persisting ginormous JSON of UpdateReport for hundreds of JARs was real. Eventually in 2019 I added
File (absolute path) vs VirtualFileRefSimilarly for Zinc, we use to represent all file information using back to DiagnosticIt might be useful to estimate the performance impact. I think there's some cap (100?) warnings we display per subproject, but for the purpose of talking to Metals etc, I don't think there's good reason to cut that off since it has a better UX to consume compiler warnings/errors. For the purpose of incremental compilation Analysis is often read from disk and kept in memory. We can hopefully keep a unique set of |
Beta Was this translation helpful? Give feedback.
-
I like the proposal. It seems you scratched the thing quite far already and that you know what you are doing. Don't hesitate to ping me if you need some review, testing or anything. |
Beta Was this translation helpful? Give feedback.
-
Hello! I'd like to suggest some changes to the current
Problem
interface, and get some consensus on the best way to move forward before I start hacking stuff in. The larger context to this proposal can be found in the contributors forum, but I'll included a brief summary down below.Summary
Much of the Scala ecosystem is relying on the same mechanism to report errors from Dotty, and much of the boils down to implementing the
CompilerInterface2
, which includes aReporter
, which includes someProblem
s. Many of the build tools use thisProblem
as the core way that information about a diagnostic is passed around. For example you can see examples of this in Bloop, Mill, and it's of course used all over in Zinc and sbt. The current structure of theProblem
looks like this:Current interface
While this indeed is the core information needed, there is also extra information that the compiler knows that I believe we could add similar to how
rendered
was added in a way that wouldn't break compatibility withCompilerInterface2
orProblem
. The minimal things that could really help editor-like tooling would be if theErrorMessageID
could be exposed allowing for tools to easily know the error that they're working with to potentially then offer code actions or auto-fixes, and then also a structured relationship of "related" information to a diagnostic. For example in BSP there is already a field in theirDiagnostic
,DiagnosticRelatedInformation
modeled after the LSP version, which can also contain aPosition
and amessage
. There are scenarios in Dotty already where being able to expose this in a structured way would avoid having to render multiple positions in a string to show to the user. For example.This in the current format
![image](https://user-images.githubusercontent.com/13974112/162437616-b5487192-20a0-4360-abfc-852f2c9345dd.png)
vs what it could be like if it was given to your editor structured via
DiagnosticRelatedInformation
Therefore I'd like to propose something similar to the following:
Suggested interface
I believe the best way to add them to
Problem
would probably be with defaults to ensure this won't break when using against old versions of the compiler that don't report this. If I'm following the entire chain correctly and if we were to move in this direction the change would first need to be made inProblem
and then everything else could start using it after Dotty then adds this information to theProblem
in it'sReporter
.Any thoughts on this, potential issues you see, or other suggestions? If you're happy with this, I'd be happy to start adding this in.
Beta Was this translation helpful? Give feedback.
All reactions