Skip to content

Commit

Permalink
Fix native notebook interrtupt toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne committed Jun 14, 2021
1 parent 6b1c4e9 commit 0bb374d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions news/2 Fixes/6254.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix interrupt button in Native Notebook toolbar.
4 changes: 2 additions & 2 deletions src/client/datascience/commands/activeEditorContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ export class ActiveEditorContextService implements IExtensionSingleActivationSer
.getOrCreateNotebook({ identity: activeEditor.file, resource: activeEditor.file, getOnly: true })
.then((nb) => {
if (activeEditor === this.notebookEditorProvider.activeEditor) {
const canStart = nb && nb.status !== ServerStatus.NotStarted && activeEditor.model?.isTrusted;
const canStart = nb && nb.status !== ServerStatus.NotStarted;
this.canRestartNotebookKernelContext.set(!!canStart).ignoreErrors();
const canInterrupt = nb && nb.status === ServerStatus.Busy && activeEditor.model?.isTrusted;
const canInterrupt = nb && nb.status === ServerStatus.Busy;
this.canInterruptNotebookKernelContext.set(!!canInterrupt).ignoreErrors();
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { captureTelemetry } from '../../telemetry';
import { CommandSource } from '../../testing/common/constants';
import { Commands, Telemetry } from '../constants';
import { IDataScienceCommandListener, IDataScienceErrorHandler, INotebookEditorProvider } from '../types';
import { isUri } from '../../common/utils/misc';

@injectable()
export class NativeEditorCommandListener implements IDataScienceCommandListener {
Expand Down Expand Up @@ -93,7 +94,7 @@ export class NativeEditorCommandListener implements IDataScienceCommandListener

private interruptKernel(notebookUri: Uri | undefined) {
// `document` may be undefined if this command is invoked from the command palette.
if (notebookUri) {
if (isUri(notebookUri)) {
traceInfo(`Interrupt requested for ${notebookUri.toString()} in nativeEditorCommandListener`);
traceInfo(`this.provider.activeEditor?.file.toString() = ${this.provider.activeEditor?.file.toString()}`);
traceInfo(`this.provider.editors = ${this.provider.editors.map((item) => item.file.toString())}`);
Expand Down

0 comments on commit 0bb374d

Please sign in to comment.