File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,24 @@ impl fmt::Display for ShaderError<crate::WithSpan<crate::valid::ValidationError>
48
48
let config = term:: Config :: default ( ) ;
49
49
let mut writer = termcolor:: NoColor :: new ( Vec :: new ( ) ) ;
50
50
51
- let diagnostic = Diagnostic :: error ( ) . with_labels (
51
+ let err_chain = {
52
+ use std:: fmt:: Write ;
53
+
54
+ let mut msg_buf = String :: new ( ) ;
55
+ write ! ( msg_buf, "{}" , self . inner) . unwrap ( ) ;
56
+
57
+ let mut source = self . inner . source ( ) ;
58
+ while let Some ( next) = source {
59
+ // NOTE: The spacing here matters for presentation as a `Diagnostic`. Formula used:
60
+ //
61
+ // * 7 spaces to offset `error: `
62
+ // * 2 more spaces for "compact" indentation of the original error
63
+ writeln ! ( msg_buf, " {next}" ) . unwrap ( ) ;
64
+ source = next. source ( ) ;
65
+ }
66
+ msg_buf
67
+ } ;
68
+ let diagnostic = Diagnostic :: error ( ) . with_message ( err_chain) . with_labels (
52
69
self . inner
53
70
. spans ( )
54
71
. map ( |& ( span, ref desc) | {
You can’t perform that action at this time.
0 commit comments