Skip to content

Commit 2332c51

Browse files
committed
feat: initial notebook support
1 parent 861f6b9 commit 2332c51

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/controller.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export class RPCController {
8282
const fileSwitch = window.onDidChangeActiveTextEditor(() => sendActivity(true));
8383
const fileEdit = workspace.onDidChangeTextDocument(this.activityThrottle.callable);
8484
const fileSelectionChanged = window.onDidChangeTextEditorSelection(this.activityThrottle.callable);
85+
const notebookSelectionChanged = window.onDidChangeNotebookEditorSelection(this.activityThrottle.callable);
8586
const debugStart = debug.onDidStartDebugSession(() => sendActivity());
8687
const debugEnd = debug.onDidTerminateDebugSession(() => sendActivity());
8788
const diagnosticsChange = languages.onDidChangeDiagnostics(() => onDiagnosticsChange());
@@ -91,7 +92,15 @@ export class RPCController {
9192
if (config.get(CONFIG_KEYS.Status.Problems.Enabled)) this.listeners.push(diagnosticsChange);
9293
if (config.get(CONFIG_KEYS.Status.Idle.Check)) this.listeners.push(changeWindowState);
9394

94-
this.listeners.push(fileSwitch, fileEdit, fileSelectionChanged, debugStart, debugEnd, gitListener);
95+
this.listeners.push(
96+
fileSwitch,
97+
fileEdit,
98+
fileSelectionChanged,
99+
notebookSelectionChanged,
100+
debugStart,
101+
debugEnd,
102+
gitListener
103+
);
95104
}
96105

97106
private async checkIdle(windowState: WindowState) {

src/data.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
EventEmitter,
1313
extensions,
1414
window,
15-
workspace
15+
workspace,
16+
NotebookEditor
1617
} from "vscode";
1718

1819
const ALLOWED_SCHEME = ["file", "vscode-remote"];
@@ -39,6 +40,7 @@ export class Data implements DisposableLike {
3940
private gitApi: GitApi | undefined;
4041

4142
public editor: TextEditor | undefined;
43+
public notebookEditor: NotebookEditor | undefined;
4244

4345
public constructor(debug: boolean = false) {
4446
this._debug = debug;
@@ -58,6 +60,11 @@ export class Data implements DisposableLike {
5860
this.editor = e;
5961
this.updateGit();
6062
}),
63+
window.onDidChangeActiveNotebookEditor((e) => {
64+
this.debug("root(): window.onDidChangeActiveNotebookEditor");
65+
this.notebookEditor = e;
66+
this.updateGit();
67+
}),
6168
workspace.onDidChangeWorkspaceFolders(() => {
6269
this.debug("root(): workspace.onDidChangeWorkspaceFolders");
6370
this.updateGit();

0 commit comments

Comments
 (0)