diff --git a/src/controller.ts b/src/controller.ts index f29ba24c..13e0c70a 100644 --- a/src/controller.ts +++ b/src/controller.ts @@ -82,6 +82,7 @@ export class RPCController { const fileSwitch = window.onDidChangeActiveTextEditor(() => sendActivity(true)); const fileEdit = workspace.onDidChangeTextDocument(this.activityThrottle.callable); const fileSelectionChanged = window.onDidChangeTextEditorSelection(this.activityThrottle.callable); + const notebookSelectionChanged = window.onDidChangeNotebookEditorSelection(this.activityThrottle.callable); const debugStart = debug.onDidStartDebugSession(() => sendActivity()); const debugEnd = debug.onDidTerminateDebugSession(() => sendActivity()); const diagnosticsChange = languages.onDidChangeDiagnostics(() => onDiagnosticsChange()); @@ -91,7 +92,15 @@ export class RPCController { if (config.get(CONFIG_KEYS.Status.Problems.Enabled)) this.listeners.push(diagnosticsChange); if (config.get(CONFIG_KEYS.Status.Idle.Check)) this.listeners.push(changeWindowState); - this.listeners.push(fileSwitch, fileEdit, fileSelectionChanged, debugStart, debugEnd, gitListener); + this.listeners.push( + fileSwitch, + fileEdit, + fileSelectionChanged, + notebookSelectionChanged, + debugStart, + debugEnd, + gitListener + ); } private async checkIdle(windowState: WindowState) { diff --git a/src/data.ts b/src/data.ts index bb72ba60..61be151a 100644 --- a/src/data.ts +++ b/src/data.ts @@ -12,7 +12,8 @@ import { EventEmitter, extensions, window, - workspace + workspace, + NotebookEditor } from "vscode"; const ALLOWED_SCHEME = ["file", "vscode-remote"]; @@ -39,6 +40,7 @@ export class Data implements DisposableLike { private gitApi: GitApi | undefined; public editor: TextEditor | undefined; + public notebookEditor: NotebookEditor | undefined; public constructor(debug: boolean = false) { this._debug = debug; @@ -58,6 +60,11 @@ export class Data implements DisposableLike { this.editor = e; this.updateGit(); }), + window.onDidChangeActiveNotebookEditor((e) => { + this.debug("root(): window.onDidChangeActiveNotebookEditor"); + this.notebookEditor = e; + this.updateGit(); + }), workspace.onDidChangeWorkspaceFolders(() => { this.debug("root(): workspace.onDidChangeWorkspaceFolders"); this.updateGit();