[BUG] Bad CSS error reporting
Checklist before submitting an issue
- [X] I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
- [X] I have specifically verified that this bug is not a common user error
- [X] I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)
Description of the bug
When an error occurs in the CSS, error reporting currently looks roughly like this:
2022-04-29T09:08:32.321Z ERROR eww::error_handling_ctx > <data>:6:17'backgound-color' is not a valid property name
Which is,... not good.
Reproducing the issue
No response
Expected behaviour
Optimally, we'd want to show the error properly, with the same format that we also show yuck errors with.
Additional context
This requires implementing a bit of architecture around scss file loading, as currently we're not keeping track of the filenames/paths anywhere.
When implementing that, we can use that opportunity to also make use of grass's new Fs trait, which let's us intercept file system interactions, thus allowing us to do our further preprocessing on included files (i.e. replacing environment variables)
As said in #466, messing with scss imports and getting the paths wrong I got these types of errors:
eww/modules/volume on main [✘!] took 3s
❯ eww reload
Encountered SCSS parsing error: SassError { kind: ParseError { message: "Can't find stylesheet to import.", loc: SpanLoc { file: File("stdin"), begin: LineCol { line: 0, column: 8 }, end: LineCol { line: 0, column: 9 } }, unicode: true } }
These should say where the faulty import is (which file/line), otherwise debugging can be difficult.
Currently, I implemented parsing GTK css errors and rendering them nicely using ewws diagnostic system.
SCSS errors however still get rendered by grass, as the API there doesn't really allow me to properly access all the required information (as codemap's Pos type doesn't expose the underlying number,... REEEEE).
Also still not properly implementing the Fs trait yet