Skip to content

Commit c198dc9

Browse files
committed
エラーの見た目を調整
1 parent 39eef6c commit c198dc9

2 files changed

Lines changed: 18 additions & 25 deletions

File tree

app/globals.css

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -114,24 +114,6 @@ mycdark:
114114
.ace_selected-word {
115115
@apply border-primary!;
116116
}
117-
.ace_error-marker {
118-
position: absolute;
119-
background-color: rgba(239, 68, 68, 0.2);
120-
border-bottom: 2px wavy rgb(239, 68, 68);
121-
z-index: 20;
122-
}
123-
.ace_warning-marker {
124-
position: absolute;
125-
background-color: rgba(245, 158, 11, 0.2);
126-
border-bottom: 2px wavy rgb(245, 158, 11);
127-
z-index: 20;
128-
}
129-
.ace_info-marker {
130-
position: absolute;
131-
background-color: rgba(59, 130, 246, 0.2);
132-
border-bottom: 2px dotted rgb(59, 130, 246);
133-
z-index: 20;
134-
}
135117

136118
.rounded-box-modal {
137119
@apply rounded-box;

app/terminal/editor.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export function EditorComponent(props: EditorProps) {
5555
const annotations = useMemo(() => {
5656
return fileDiagnostics.flatMap((diag) =>
5757
diag.frames
58+
.slice(0, 1)
5859
.filter((f) => f.filename === props.filename)
5960
.map((f) => ({
6061
row: Math.max(0, f.startLineNumber - 1),
@@ -68,26 +69,36 @@ export function EditorComponent(props: EditorProps) {
6869
const markers = useMemo(() => {
6970
return fileDiagnostics.flatMap((diag) =>
7071
diag.frames
72+
.map((f, i) => ({ ...f, isFirstFrame: i === 0 }))
7173
.filter((f) => f.filename === props.filename)
7274
.map((f) => {
7375
const startRow = Math.max(0, f.startLineNumber - 1);
7476
const endRow = f.endLineNumber
75-
? Math.max(0, f.endLineNumber - 1)
77+
? Math.max(startRow, f.endLineNumber - 1)
7678
: startRow;
7779
const startCol =
7880
f.startColumn !== undefined ? Math.max(0, f.startColumn - 1) : 0;
7981
const endCol =
8082
f.endColumn !== undefined
81-
? Math.max(0, f.endColumn - 1)
83+
? Math.max(startCol + 1, f.endColumn - 1)
8284
: Number.MAX_SAFE_INTEGER;
8385

8486
const isError = (diag.severity ?? "error") === "error";
8587
const isWarning = diag.severity === "warning";
86-
const className = isError
87-
? "ace_error-marker"
88-
: isWarning
89-
? "ace_warning-marker"
90-
: "ace_info-marker";
88+
const className = clsx(
89+
"absolute rounded-b-none! border-dashed border-b-1",
90+
isError
91+
? "border-error"
92+
: isWarning
93+
? "border-warning"
94+
: "border-accent",
95+
f.isFirstFrame &&
96+
(isError
97+
? "bg-error/20"
98+
: isWarning
99+
? "bg-warning/20"
100+
: "bg-accent/20")
101+
);
91102

92103
return {
93104
startRow,

0 commit comments

Comments
 (0)