Skip to content

Commit 17d8705

Browse files
committed
[red-knot] Fix stale syntax errors in playground
1 parent 27ecf35 commit 17d8705

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

playground/knot/src/Editor/Diagnostics.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,25 @@ function Items({
6262
);
6363
}
6464

65+
const uniqueIds: Map<string, number> = new Map();
66+
6567
return (
6668
<ul className="space-y-0.5 grow overflow-y-scroll">
67-
{diagnostics.map((diagnostic, index) => {
69+
{diagnostics.map((diagnostic) => {
6870
const position = diagnostic.range;
6971
const start = position?.start;
7072
const id = diagnostic.id;
7173

7274
const startLine = start?.line ?? 1;
7375
const startColumn = start?.column ?? 1;
7476

77+
const mostlyUniqueId = `${startLine}:${startColumn}-${id}`;
78+
79+
const disambiguator = uniqueIds.get(mostlyUniqueId) ?? 0;
80+
uniqueIds.set(mostlyUniqueId, disambiguator + 1);
81+
7582
return (
76-
<li key={`${startLine}:${startColumn}-${id ?? index}`}>
83+
<li key={`${mostlyUniqueId}-${disambiguator}`}>
7784
<button
7885
onClick={() => onGoTo(startLine, startColumn)}
7986
className="w-full text-start cursor-pointer select-text"

0 commit comments

Comments
 (0)