Skip to content

Commit f9d5034

Browse files
committed
fix: check that editor is a CodeEditor
This prepares for the addition of additional editor types.
1 parent 4dad260 commit f9d5034

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/extension.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ export function activate(context: sourcegraph.ExtensionContext): void {
1818

1919
if (sourcegraph.app.activeWindowChanges) {
2020
const selectionChanges = from(sourcegraph.app.activeWindowChanges).pipe(
21-
filter((window): window is sourcegraph.Window => window !== undefined),
21+
filter((window): window is Exclude<typeof window, undefined> => window !== undefined),
2222
switchMap(window => window.activeViewComponentChanges),
23-
filter((editor): editor is sourcegraph.CodeEditor => editor !== undefined),
23+
filter((editor): editor is sourcegraph.CodeEditor => !!editor && editor.type === 'CodeEditor'),
2424
switchMap(editor => from(editor.selectionsChanges).pipe(map(selections => ({ editor, selections }))))
2525
)
2626
// When the configuration or current file changes, publish new decorations.
@@ -36,7 +36,7 @@ export function activate(context: sourcegraph.ExtensionContext): void {
3636
context.subscriptions.add(
3737
combineLatest(configurationChanges, from(sourcegraph.workspace.openedTextDocuments)).subscribe(async () => {
3838
const editor = activeEditor()
39-
if (editor) {
39+
if (editor && editor.type === 'CodeEditor') {
4040
await decorate(editor, null)
4141
}
4242
})

0 commit comments

Comments
 (0)