@@ -14,14 +14,18 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
14
14
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry' ;
15
15
import { ResourceNotebookCellEdit } from 'vs/workbench/contrib/bulkEdit/browser/bulkCellEdits' ;
16
16
import { changeCellToKind , computeCellLinesContents , copyCellRange , joinCellsWithSurrounds , joinSelectedCells , moveCellRange } from 'vs/workbench/contrib/notebook/browser/controller/cellOperations' ;
17
- import { cellExecutionArgs , CellOverflowToolbarGroups , CellToolbarOrder , CELL_TITLE_CELL_GROUP_ID , INotebookCellActionContext , INotebookCellToolbarActionContext , INotebookCommandContext , NotebookCellAction , NotebookMultiCellAction , parseMultiCellExecutionArgs } from 'vs/workbench/contrib/notebook/browser/controller/coreActions' ;
17
+ import { cellExecutionArgs , CellOverflowToolbarGroups , CellToolbarOrder , CELL_TITLE_CELL_GROUP_ID , INotebookCellActionContext , INotebookCellToolbarActionContext , INotebookCommandContext , NotebookCellAction , NotebookMultiCellAction , parseMultiCellExecutionArgs , findTargetCellEditor } from 'vs/workbench/contrib/notebook/browser/controller/coreActions' ;
18
18
import { CellFocusMode , EXPAND_CELL_INPUT_COMMAND_ID , EXPAND_CELL_OUTPUT_COMMAND_ID , ICellOutputViewModel , ICellViewModel , INotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookBrowser' ;
19
- import { NOTEBOOK_CELL_EDITABLE , NOTEBOOK_CELL_HAS_OUTPUTS , NOTEBOOK_CELL_INPUT_COLLAPSED , NOTEBOOK_CELL_LIST_FOCUSED , NOTEBOOK_CELL_OUTPUT_COLLAPSED , NOTEBOOK_CELL_TYPE , NOTEBOOK_EDITOR_EDITABLE , NOTEBOOK_EDITOR_FOCUSED , NOTEBOOK_IS_ACTIVE_EDITOR , NOTEBOOK_OUTPUT_FOCUSED } from 'vs/workbench/contrib/notebook/common/notebookContextKeys' ;
19
+ import { NOTEBOOK_CELL_EDITABLE , NOTEBOOK_CELL_EDITOR_FOCUSED , NOTEBOOK_CELL_FOCUSED , NOTEBOOK_CELL_HAS_ERROR_DIAGNOSTICS , NOTEBOOK_CELL_HAS_OUTPUTS , NOTEBOOK_CELL_INPUT_COLLAPSED , NOTEBOOK_CELL_LIST_FOCUSED , NOTEBOOK_CELL_OUTPUT_COLLAPSED , NOTEBOOK_CELL_TYPE , NOTEBOOK_EDITOR_EDITABLE , NOTEBOOK_EDITOR_FOCUSED , NOTEBOOK_IS_ACTIVE_EDITOR , NOTEBOOK_OUTPUT_FOCUSED } from 'vs/workbench/contrib/notebook/common/notebookContextKeys' ;
20
20
import * as icons from 'vs/workbench/contrib/notebook/browser/notebookIcons' ;
21
21
import { CellEditType , CellKind , NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon' ;
22
22
import { INotificationService } from 'vs/platform/notification/common/notification' ;
23
23
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys' ;
24
24
import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
25
+ import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel' ;
26
+ import { Range } from 'vs/editor/common/core/range' ;
27
+ import { CodeActionController } from 'vs/editor/contrib/codeAction/browser/codeActionController' ;
28
+ import { CodeActionKind , CodeActionTriggerSource } from 'vs/editor/contrib/codeAction/common/types' ;
25
29
26
30
//#region Move/Copy cells
27
31
const MOVE_CELL_UP_COMMAND_ID = 'notebook.cell.moveUp' ;
@@ -353,6 +357,7 @@ const COLLAPSE_ALL_CELL_OUTPUTS_COMMAND_ID = 'notebook.cell.collapseAllCellOutpu
353
357
const EXPAND_ALL_CELL_OUTPUTS_COMMAND_ID = 'notebook.cell.expandAllCellOutputs' ;
354
358
const TOGGLE_CELL_OUTPUTS_COMMAND_ID = 'notebook.cell.toggleOutputs' ;
355
359
const TOGGLE_CELL_OUTPUT_SCROLLING = 'notebook.cell.toggleOutputScrolling' ;
360
+ const OPEN_CELL_FAILURE_ACTIONS_COMMAND_ID = 'notebook.cell.openFailureActions' ;
356
361
357
362
registerAction2 ( class CollapseCellInputAction extends NotebookMultiCellAction {
358
363
constructor ( ) {
@@ -579,6 +584,45 @@ registerAction2(class ToggleCellOutputScrolling extends NotebookMultiCellAction
579
584
}
580
585
} ) ;
581
586
587
+ registerAction2 ( class ExpandAllCellOutputsAction extends NotebookCellAction {
588
+ constructor ( ) {
589
+ super ( {
590
+ id : OPEN_CELL_FAILURE_ACTIONS_COMMAND_ID ,
591
+ title : localize2 ( 'notebookActions.cellFailureActions' , "Show Cell Failure Actions" ) ,
592
+ precondition : ContextKeyExpr . and ( NOTEBOOK_CELL_FOCUSED , NOTEBOOK_CELL_HAS_ERROR_DIAGNOSTICS , NOTEBOOK_CELL_EDITOR_FOCUSED . toNegated ( ) ) ,
593
+ f1 : true ,
594
+ keybinding : {
595
+ when : ContextKeyExpr . and ( NOTEBOOK_CELL_FOCUSED , NOTEBOOK_CELL_HAS_ERROR_DIAGNOSTICS , NOTEBOOK_CELL_EDITOR_FOCUSED . toNegated ( ) ) ,
596
+ primary : KeyMod . CtrlCmd | KeyCode . Period ,
597
+ weight : KeybindingWeight . WorkbenchContrib
598
+ }
599
+ } ) ;
600
+ }
601
+
602
+ async runWithContext ( accessor : ServicesAccessor , context : INotebookCellActionContext ) : Promise < void > {
603
+ if ( context . cell instanceof CodeCellViewModel ) {
604
+ const error = context . cell . cellErrorDetails ;
605
+ if ( error ?. location ) {
606
+ const location = Range . lift ( {
607
+ startLineNumber : error . location . startLineNumber + 1 ,
608
+ startColumn : error . location . startColumn + 1 ,
609
+ endLineNumber : error . location . endLineNumber + 1 ,
610
+ endColumn : error . location . endColumn + 1
611
+ } ) ;
612
+ context . notebookEditor . setCellEditorSelection ( context . cell , Range . lift ( location ) ) ;
613
+ const editor = findTargetCellEditor ( context , context . cell ) ;
614
+ if ( editor ) {
615
+ const controller = CodeActionController . get ( editor ) ;
616
+ controller ?. manualTriggerAtCurrentPosition (
617
+ localize ( 'cellCommands.quickFix.noneMessage' , "No code actions available" ) ,
618
+ CodeActionTriggerSource . Default ,
619
+ { include : CodeActionKind . QuickFix } ) ;
620
+ }
621
+ }
622
+ }
623
+ }
624
+ } ) ;
625
+
582
626
//#endregion
583
627
584
628
function forEachCell ( editor : INotebookEditor , callback : ( cell : ICellViewModel , index : number ) => void ) {
0 commit comments