Skip to content

Commit 468e831

Browse files
Merge pull request #466 from SwiftFiddle/err
Styling
2 parents 874c067 + e4c4344 commit 468e831

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

Public/css/highlight.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@
8585
color: #c0c;
8686
}
8787

88-
.exp-error {
89-
background: #d22;
88+
.exp-syntax-error {
89+
border-top: solid 2px #d22;
9090
}
9191

9292
span.match-char {

Public/js/views/expression_field.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class ExpressionField extends EventDispatcher {
5353
this.highlighter.clearError();
5454
}
5555

56-
tippy(".exp-error", {
56+
tippy(".exp-syntax-error", {
5757
allowHTML: true,
5858
animation: false,
5959
placement: "bottom",

Public/js/views/expression_highlighter.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,20 @@ export default class ExpressionHighlighter extends EventDispatcher {
7474
error.location.end - error.location.start
7575
);
7676
const widget = document.createElement("span");
77-
widget.className = `${pre}-error`;
77+
widget.className = `${pre}-syntax-error`;
7878

79-
widget.style.height = `2px`;
79+
widget.style.height = `5px`;
8080
widget.style.zIndex = "10";
81-
widget.setAttribute("data-tippy-content", error.message);
81+
widget.setAttribute(
82+
"data-tippy-content",
83+
`<span class="fw-bolder text-danger">${error.behavior}:</span> ${error.message}`
84+
);
8285

8386
editor.addWidget(location.startPos, widget);
8487
const startCoords = editor.charCoords(location.startPos, "local");
8588
const endCoords = editor.charCoords(location.endPos, "local");
8689
widget.style.left = `${startCoords.left + 1}px`;
87-
widget.style.top = `${startCoords.bottom}px`;
90+
widget.style.top = `${startCoords.bottom - 1}px`;
8891
widget.style.width = `${endCoords.left - startCoords.left - 2}px`;
8992

9093
this.widgets.push(widget);

0 commit comments

Comments
 (0)