Skip to content
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

Fix native notebook interrupt toolbar #6280

Merged
merged 1 commit into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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