Skip to content

Commit eb58e8d

Browse files
add event handler for active text editor changes
1 parent b936736 commit eb58e8d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/documentation/DocumentationPreviewEditor.ts

+9
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export class DocumentationPreviewEditor implements vscode.Disposable {
110110
this.activeTextEditor = vscode.window.activeTextEditor;
111111
this.subscriptions.push(
112112
this.webviewPanel.webview.onDidReceiveMessage(this.receiveMessage, this),
113+
vscode.window.onDidChangeActiveTextEditor(this.handleActiveTextEditorChange, this),
113114
vscode.window.onDidChangeTextEditorSelection(
114115
this.handleTextEditorSelectionChange,
115116
this
@@ -166,6 +167,14 @@ export class DocumentationPreviewEditor implements vscode.Disposable {
166167
}
167168
}
168169

170+
private handleActiveTextEditorChange(textEditor: vscode.TextEditor | undefined) {
171+
if (textEditor === undefined) {
172+
return;
173+
}
174+
this.activeTextEditor = textEditor;
175+
this.convertDocumentation(textEditor);
176+
}
177+
169178
private handleTextEditorSelectionChange(event: vscode.TextEditorSelectionChangeEvent) {
170179
if (event.textEditor === undefined) {
171180
return;

0 commit comments

Comments
 (0)