File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
anycode-base/src/renderer Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,15 @@ export class DiagnosticRenderer {
55 return line . querySelector ( 'span.diagnostic' ) ;
66 }
77
8+ private isEmptyLine ( line : AnycodeLine ) : boolean {
9+ for ( const child of line . children ) {
10+ if ( child . tagName === 'BR' ) continue ;
11+ if ( child . classList . contains ( 'diagnostic' ) ) continue ;
12+ return false ;
13+ }
14+ return true ;
15+ }
16+
817 private getInsertAnchor ( line : AnycodeLine ) : ChildNode | null {
918 const last = line . lastChild ;
1019 if ( last && last . nodeType === Node . ELEMENT_NODE ) {
@@ -14,14 +23,15 @@ export class DiagnosticRenderer {
1423 return null ;
1524 }
1625
17- public render ( line : AnycodeLine , message ?: string | null ) {
26+ public render ( line : AnycodeLine , diagnosticMessage ?: string | null ) {
1827 line . classList . remove ( 'has-error' ) ;
1928 line . removeAttribute ( 'data-error' ) ;
2029
21- const text = message ? minimize ( message ) : '' ;
30+ const text = diagnosticMessage ? minimize ( diagnosticMessage ) : '' ;
2231 const existing = this . getDiagnosticSpan ( line ) ;
2332
24- if ( ! text ) {
33+ // Don't show diagnostics on empty lines
34+ if ( ! text || this . isEmptyLine ( line ) ) {
2535 if ( existing ) existing . remove ( ) ;
2636 return ;
2737 }
You can’t perform that action at this time.
0 commit comments