Fixed #4169 shows notification when not active code cell is selected when hit F5 (#5259)

* Refine the msg
This commit is contained in:
Yurong He
2019-04-30 13:25:11 -07:00
committed by GitHub
parent 48682bacde
commit 44a2d009c0

View File

@@ -31,6 +31,7 @@ import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/un
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { viewColumnToEditorGroup } from 'vs/workbench/api/common/shared/editor';
import { notebookModeId } from 'sql/workbench/common/customInputConverter';
import { localize } from 'vs/nls';
class MainThreadNotebookEditor extends Disposable {
private _contentChangedEmitter = new Emitter<NotebookContentChange>();
@@ -360,12 +361,9 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
} else {
// Use the active cell in this case, or 1st cell if there's none active
cell = editor.model.activeCell;
if (!cell) {
cell = editor.cells.find(c => c.cellType === CellTypes.Code);
}
}
if (!cell) {
return Promise.reject(disposed(`Could not find cell for this Notebook`));
if (!cell || (cell && cell.cellType !== CellTypes.Code)) {
return Promise.reject(new Error(localize('runActiveCell', "F5 shortcut key requires a code cell to be selected. Please select a code cell to run.")));
}
return editor.runCell(cell);