-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor refactoring #7837
Minor refactoring #7837
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,11 +104,14 @@ export class InteractiveWindow implements IInteractiveWindowLoadable { | |
return this._identity; | ||
} | ||
public get notebookUri(): Uri | undefined { | ||
return this.notebookDocument?.uri; | ||
return this._notebookDocument?.uri; | ||
} | ||
public get notebookEditor(): NotebookEditor | undefined { | ||
return this._notebookEditor; | ||
} | ||
public get notebookDocument(): NotebookDocument | undefined { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exposed a property |
||
return this._notebookDocument; | ||
} | ||
private _onDidChangeViewState = new EventEmitter<void>(); | ||
private closedEvent: EventEmitter<IInteractiveWindow> = new EventEmitter<IInteractiveWindow>(); | ||
private _owner: Uri | undefined; | ||
|
@@ -124,7 +127,7 @@ export class InteractiveWindow implements IInteractiveWindowLoadable { | |
private _editorReadyPromise: Promise<NotebookEditor>; | ||
private _controllerReadyPromise: Deferred<VSCodeNotebookController>; | ||
private _kernelReadyPromise: Promise<IKernel> | undefined; | ||
private notebookDocument: NotebookDocument | undefined; | ||
private _notebookDocument: NotebookDocument | undefined; | ||
private executionPromise: Promise<boolean> | undefined; | ||
private _notebookEditor: NotebookEditor | undefined; | ||
|
||
|
@@ -162,7 +165,7 @@ export class InteractiveWindow implements IInteractiveWindowLoadable { | |
this._kernelReadyPromise = this.createKernelReadyPromise(); | ||
|
||
workspace.onDidCloseNotebookDocument((notebookDocument) => { | ||
if (notebookDocument === this.notebookDocument) { | ||
if (notebookDocument === this._notebookDocument) { | ||
this.closedEvent.fire(this); | ||
} | ||
}); | ||
|
@@ -205,7 +208,7 @@ export class InteractiveWindow implements IInteractiveWindowLoadable { | |
throw new Error('Failed to request creation of interactive window from VS Code.'); | ||
} | ||
this._notebookEditor = notebookEditor; | ||
this.notebookDocument = notebookEditor.document; | ||
this._notebookDocument = notebookEditor.document; | ||
this.internalDisposables.push( | ||
window.onDidChangeActiveNotebookEditor((e) => { | ||
if (e === this._notebookEditor) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,7 @@ | |
// Licensed under the MIT License. | ||
|
||
'use strict'; | ||
|
||
import type { KernelMessage } from '@jupyterlab/services'; | ||
import type { Kernel as JupyterKernel, KernelMessage } from '@jupyterlab/services'; | ||
import { Observable } from 'rxjs/Observable'; | ||
import { Subject } from 'rxjs/Subject'; | ||
import { | ||
|
@@ -38,7 +37,6 @@ import { getNotebookMetadata } from '../../notebook/helpers/helpers'; | |
import { | ||
IDataScienceErrorHandler, | ||
IJupyterServerUriStorage, | ||
IJupyterSession, | ||
INotebook, | ||
INotebookEditorProvider, | ||
INotebookProvider, | ||
|
@@ -409,7 +407,7 @@ export class Kernel implements IKernel { | |
|
||
if (this.connection?.localLaunch && this.notebook) { | ||
await sendTelemetryForPythonKernelExecutable( | ||
this.notebook, | ||
this, | ||
this.resourceUri, | ||
this.kernelConnectionMetadata, | ||
this.pythonExecutionFactory | ||
|
@@ -611,7 +609,10 @@ export class Kernel implements IKernel { | |
} | ||
} | ||
|
||
export async function executeSilently(session: IJupyterSession, code: string): Promise<nbformat.IOutput[]> { | ||
export async function executeSilently( | ||
session: Pick<JupyterKernel.IKernelConnection, 'requestExecute'>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No longer using our types, directly using Jupyter Lab API types. |
||
code: string | ||
): Promise<nbformat.IOutput[]> { | ||
// eslint-disable-next-line @typescript-eslint/no-require-imports | ||
const jupyterLab = require('@jupyterlab/services') as typeof import('@jupyterlab/services'); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,6 +164,7 @@ export interface IKernelProvider extends IAsyncDisposable { | |
readonly kernels: Readonly<IKernel[]>; | ||
onDidRestartKernel: Event<IKernel>; | ||
onDidDisposeKernel: Event<IKernel>; | ||
onKernelStatusChanged: Event<{ status: ServerStatus; kernel: IKernel }>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved from INotebook to IKernel, easier & looking at NotebookWatcher, we were using Inotebook to detect changes in IKernel, |
||
/** | ||
* Get hold of the active kernel for a given Notebook. | ||
*/ | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the type of
dataProvider
the benefit is strong typeing yes, but this way when we look at removingINotebook
we won't miss such instances (i.e. this change was for future proofing changes related to INotebook)