Skip to content

Commit

Permalink
Add custom styling for deprecated diagnostic hint (#3014)
Browse files Browse the repository at this point in the history
  • Loading branch information
parlough authored Jun 24, 2024
1 parent 49f89fe commit 79aea11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkgs/dartpad_ui/lib/editor/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,15 @@ class _EditorWidgetState extends State<EditorWidget> implements EditorService {
for (final issue in issues) {
final line = math.max(issue.location.line - 1, 0);
final column = math.max(issue.location.column - 1, 0);
final isDeprecation =
issue.code?.contains('deprecated_member_use') ?? false;
final kind = isDeprecation ? 'deprecation' : issue.kind;

doc.markText(
Position(line: line, ch: column),
Position(line: line, ch: column + issue.location.charLength),
MarkTextOptions(
className: 'squiggle-${issue.kind}',
className: 'squiggle-$kind',
title: issue.message,
),
);
Expand Down
4 changes: 4 additions & 0 deletions pkgs/dartpad_ui/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
.squiggle-error {
border-bottom: 2px solid #EF5350;
}
.squiggle-deprecation {
text-decoration: line-through;
text-decoration-thickness: 10%;
}

.CodeMirror-simplescroll-horizontal div, .CodeMirror-simplescroll-vertical div {
position: absolute;
Expand Down

0 comments on commit 79aea11

Please sign in to comment.