提交 2f5339fb 编写于 作者: J Joyce Er

Allow undefined context for `notebook.selectKernel`

上级 1632a12f
......@@ -98,20 +98,18 @@ registerAction2(class extends Action2 {
const logService = accessor.get(ILogService);
const viewletService = accessor.get(IViewletService);
let editor;
if (context !== undefined) {
if ('notebookEditorId' in context) {
const editorId = context.notebookEditorId;
const matchingEditor = editorService.visibleEditorPanes.find((editorPane) => {
const notebookEditor = getNotebookEditorFromEditorPane(editorPane);
return notebookEditor?.getId() === editorId;
});
editor = getNotebookEditorFromEditorPane(matchingEditor);
} else if ('notebookEditor' in context) {
editor = context?.notebookEditor;
} else {
editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
}
let editor: INotebookEditor | undefined;
if (context !== undefined && 'notebookEditorId' in context) {
const editorId = context.notebookEditorId;
const matchingEditor = editorService.visibleEditorPanes.find((editorPane) => {
const notebookEditor = getNotebookEditorFromEditorPane(editorPane);
return notebookEditor?.getId() === editorId;
});
editor = getNotebookEditorFromEditorPane(matchingEditor);
} else if (context !== undefined && 'notebookEditor' in context) {
editor = context?.notebookEditor;
} else {
editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
}
if (!editor || !editor.hasModel()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册