mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
LibJS+LibWebView: Treat trivia tokens as comments
Trivia is whatever whitespace and comments appear before a token. Previously this was always given a TokenCategory of Invalid, so it would be displayed as an error in the view-source page, with red wiggly underlines. Instead, treat it as what it actually is: whitespace and comments!
This commit is contained in:
parent
38c1ac767d
commit
9b7fb0850d
Notes:
github-actions[bot]
2025-03-04 20:59:17 +00:00
Author: https://github.com/AtkinsSJ
Commit: 9b7fb0850d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3803
Reviewed-by: https://github.com/trflynn89 ✅
3 changed files with 5 additions and 1 deletions
|
@ -78,7 +78,7 @@ void SyntaxHighlighter::rehighlight(Palette const& palette)
|
|||
Syntax::TextDocumentSpan span;
|
||||
span.range.set_start(start);
|
||||
span.range.set_end({ position.line(), position.column() });
|
||||
auto type = is_trivia ? TokenType::Invalid : token.type();
|
||||
auto type = is_trivia ? TokenType::Trivia : token.type();
|
||||
span.attributes = style_for_token_type(palette, type);
|
||||
span.is_skippable = is_trivia;
|
||||
span.data = static_cast<u64>(type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue