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

Add logging for kernel context keys #15916

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 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
16 changes: 16 additions & 0 deletions src/standalone/context/activeEditorContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { getNotebookMetadata, isJupyterNotebook } from '../../platform/common/ut
import { isPythonNotebook } from '../../kernels/helpers';
import { IControllerRegistration } from '../../notebooks/controllers/types';
import { IJupyterServerProviderRegistry } from '../../kernels/jupyter/types';
import { logger } from '../../platform/logging';

/**
* Tracks a lot of the context keys needed in the extension.
Expand Down Expand Up @@ -163,6 +164,15 @@ export class ActiveEditorContextService implements IExtensionSyncActivationServi
const canInterrupt = kernel.status === 'busy';
this.canInterruptNotebookKernelContext.set(!!canInterrupt).catch(noop);
} else {
logger.debug('Context Key jupyter.notebookeditor.canrestartNotebookkernel = FALSE');
logger.debug(
'Active Editor Notebook Type: ',
activeEditor ? activeEditor.notebook.notebookType : 'No Active Notebook'
);
logger.debug(
'Kernel: ',
activeEditor ? this.kernelProvider.get(activeEditor.notebook) : 'No Active Notebook'
);
this.canRestartNotebookKernelContext.set(false).catch(noop);
this.canInterruptNotebookKernelContext.set(false).catch(noop);
}
Expand Down Expand Up @@ -196,6 +206,12 @@ export class ActiveEditorContextService implements IExtensionSyncActivationServi
if (document && isJupyterNotebook(document) && this.controllers.getSelected(document)) {
this.isJupyterKernelSelected.set(true).catch(noop);
} else {
logger.debug('Context Key isJupyter = FALSE');
logger.debug('isJupyterNotebook: ', document ? isJupyterNotebook(document) : 'No NotebookDocument');
logger.debug(
'controllers.getSelected: ',
document ? this.controllers.getSelected(document) : 'No NotebookDocument'
);
this.isJupyterKernelSelected.set(false).catch(noop);
}
}
Expand Down
Loading