Skip to content
This repository was archived by the owner on Nov 29, 2025. It is now read-only.

Commit d4181e4

Browse files
committed
Dark themed token highlights
1 parent 7e3f79a commit d4181e4

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

token-highlights/src/extension.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,25 @@ const highlightMatchingLines = (text, token) => {
2424
.split("\n")
2525
.map((line, i) => [i, line] as [number, string])
2626
.filter(([_, line]) => new RegExp("\\b" + token + "\\b").test(line))
27-
.map(([i, _]) => ({
28-
range: new sourcegraph.Range(
29-
new sourcegraph.Position(i, 0),
30-
new sourcegraph.Position(i, 0)
31-
),
32-
backgroundColor: "khaki"
33-
}))
27+
.map(
28+
([i, _]) =>
29+
({
30+
range: new sourcegraph.Range(
31+
new sourcegraph.Position(i, 0),
32+
new sourcegraph.Position(i, 0)
33+
),
34+
light: {
35+
backgroundColor: "khaki"
36+
},
37+
dark: {
38+
backgroundColor: "#504821"
39+
}
40+
} as sourcegraph.TextDocumentDecoration)
41+
)
3442
);
3543
};
3644

37-
export function activate(ctx:sourcegraph.ExtensionContext): void {
45+
export function activate(ctx: sourcegraph.ExtensionContext): void {
3846
ctx.subscriptions.add(
3947
sourcegraph.languages.registerHoverProvider(["*"], {
4048
provideHover: (doc, pos) => {
@@ -47,5 +55,5 @@ export function activate(ctx:sourcegraph.ExtensionContext): void {
4755
return null;
4856
}
4957
})
50-
)
58+
);
5159
}

0 commit comments

Comments
 (0)