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

Refactor compilation diagnostics, add them to compilation status page #1762

Merged
merged 4 commits into from
Feb 8, 2024

Conversation

exyi
Copy link
Member

@exyi exyi commented Jan 16, 2024

This is a large commit of various interdependent changes with the simple goal of adding warnings to the compilation status page.

  • Non-critical errors from tokens are now reported as warnings. Before, they were ignored completely.
  • Added IDiagnosticsCompilationTracer interface
    • it allows watching the compilation process, for example observing changes made by various visitors or in this case getting the warnings when the compilation otherwise succeeds
  • Added DotvvmCompilationDiagnostic and DotvvmCompilationSourceLocation records
    • it designed to be a generic class for warnings and errors from the DotHTML compilation. It contains references to the syntax and resolved trees, so it should not be stored long-term, but provides all the possible detail about each reported error/warning.
  • BindingCompilationException is refactored to use the DotvvmCompilationDiagnostics and support any number of them.
    • plus, IDotvvmException compatibility is added
    • the exception will present as the "first" / primary error for better compatibility
  • ErrorCheckingVisitor is now smarter about binding errors, the BindingToken ranges are mapped into the DothtmlToken so we can underline only the affected part of the binding. This is somewhat important for displaying diagnostics of multiline bindings in the compilation page. Multiple errors can be collected from the error.
  • ViewCompilationService now collects the warnings and errors from the tracer and DotvvmCompilationException
  • And finally, the compilation displays up to 8 errors and warnings encountered during the page compilation under each row. Warnings tab was also added which shows only the views with at least one warning/error

image
image

@exyi exyi added this to the Version 4.3 milestone Jan 16, 2024
@exyi
Copy link
Member Author

exyi commented Jan 16, 2024

I have also added logging of compilation of error, in addition to the warnings added in #1659
image

@exyi exyi force-pushed the compilation-page-warnings branch 2 times, most recently from 9cab783 to 1f548e9 Compare January 16, 2024 21:43
This is a large commit of various interdependent changes with
the simple goal of adding warnings to the compilation status page.

* Non-critical errors from tokens are now reported as warnings.
   Before, they were ignored completely.
* Added IDiagnosticsCompilationTracer interface
   - it allows watching the compilation process, for example
     observing changes made by various visitors or
     in this case getting the warnings when the compilation
     otherwise succeeds
* Added DotvvmCompilationDiagnostic and
   DotvvmCompilationSourceLocation records
   - it designed to be a generic class for warnings and errors from
     the DotHTML compilation. It contains references to the syntax
     and resolved trees, so it should not be stored long-term, but
     provides all the possible detail about each reported error/warning.
* BindingCompilationException is refactored to use the
   DotvvmCompilationDiagnostics and support any number of them.
   - plus, IDotvvmException compatibility is added
   - the exception will present as the "first" / primary error for better compatibility
* ErrorCheckingVisitor is now smarter about binding errors,
   the BindingToken ranges are mapped into the DothtmlToken
   so we can underline only the affected part of the binding.
   This is somewhat important for displaying diagnostics
   of multiline bindings in the compilation page.
   Multiple errors can be collected from the error.
* ViewCompilationService now collects the warnings and errors
   from the tracer and DotvvmCompilationException
* And finally, the compilation displays up to 8 errors and warnings
   encountered during the page compilation under each row.
   Warnings tab was also added which shows only the views with at
   least one warning/error
ex.FileName = Path.Combine(
file.FullPath.Remove(file.FullPath.Length - file.FileName.Length),
ex.FileName);
fileName = Path.Combine(file.FullPath.Remove(file.FullPath.Length - file.FileName.Length), fileName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break if the FullPath does not end with FileName

@@ -0,0 +1,14 @@
<%-- @property DotVVM.Framework.Compilation.DotHtmlFileInfo.CompilationDiagnosticViewModel Diagnostic --%>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented-out code

Base automatically changed from add-AddTemplateDecorator to main February 8, 2024 11:43
@exyi exyi merged commit 7faf5a0 into main Feb 8, 2024
14 checks passed
@exyi exyi deleted the compilation-page-warnings branch February 8, 2024 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants