@codingame/monaco-vscode-notebook-service-override 25.1.2 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -2
- package/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +112 -94
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +95 -96
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +28 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +15 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +22 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +25 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +37 -44
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +211 -115
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +16 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +5 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +57 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +24 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +78 -76
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +14 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +43 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +65 -34
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +19 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +6 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +15 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +28 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +211 -170
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +11 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +158 -156
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +109 -105
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +28 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +26 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +23 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +72 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +233 -186
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +22 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +239 -151
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +85 -86
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +25 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +13 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +8 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +218 -196
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +258 -255
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +106 -98
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +63 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +55 -64
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +21 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +149 -129
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +286 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +82 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +452 -363
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +44 -61
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +203 -207
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.js +148 -104
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.js +19 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +34 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +29 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +70 -52
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +31 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +78 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +37 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +8 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +214 -119
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +38 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.js +24 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.js +2 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +26 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +35 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +468 -258
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +113 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +74 -58
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +7 -10
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookCellMatching.js +72 -16
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +70 -51
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js +195 -149
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.js +60 -81
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +7 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +104 -66
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +115 -77
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +42 -26
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +19 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -198
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +0 -333
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -261
|
@@ -13,14 +13,14 @@ import { NOTEBOOK_CELL_FOCUSED, NOTEBOOK_CELL_HAS_ERROR_DIAGNOSTICS, NOTEBOOK_CE
|
|
|
13
13
|
import { InlineChatController } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
|
|
14
14
|
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
15
15
|
|
|
16
|
-
const OPEN_CELL_FAILURE_ACTIONS_COMMAND_ID =
|
|
17
|
-
const FIX_CELL_ERROR_COMMAND_ID =
|
|
18
|
-
const EXPLAIN_CELL_ERROR_COMMAND_ID =
|
|
16
|
+
const OPEN_CELL_FAILURE_ACTIONS_COMMAND_ID = "notebook.cell.openFailureActions";
|
|
17
|
+
const FIX_CELL_ERROR_COMMAND_ID = "notebook.cell.chat.fixError";
|
|
18
|
+
const EXPLAIN_CELL_ERROR_COMMAND_ID = "notebook.cell.chat.explainError";
|
|
19
19
|
registerAction2(class extends NotebookCellAction {
|
|
20
20
|
constructor() {
|
|
21
21
|
super({
|
|
22
22
|
id: OPEN_CELL_FAILURE_ACTIONS_COMMAND_ID,
|
|
23
|
-
title: ( localize2(
|
|
23
|
+
title: ( localize2(9558, "Show Cell Failure Actions")),
|
|
24
24
|
precondition: ( ContextKeyExpr.and(NOTEBOOK_CELL_FOCUSED, NOTEBOOK_CELL_HAS_ERROR_DIAGNOSTICS, ( NOTEBOOK_CELL_EDITOR_FOCUSED.toNegated()))),
|
|
25
25
|
f1: true,
|
|
26
26
|
keybinding: {
|
|
@@ -44,7 +44,9 @@ registerAction2(class extends NotebookCellAction {
|
|
|
44
44
|
const editor = findTargetCellEditor(context, context.cell);
|
|
45
45
|
if (editor) {
|
|
46
46
|
const controller = CodeActionController.get(editor);
|
|
47
|
-
controller?.manualTriggerAtCurrentPosition(( localize(
|
|
47
|
+
controller?.manualTriggerAtCurrentPosition(( localize(9559, "No code actions available")), CodeActionTriggerSource.Default, {
|
|
48
|
+
include: CodeActionKind.QuickFix
|
|
49
|
+
});
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
}
|
|
@@ -54,7 +56,7 @@ registerAction2(class extends NotebookCellAction {
|
|
|
54
56
|
constructor() {
|
|
55
57
|
super({
|
|
56
58
|
id: FIX_CELL_ERROR_COMMAND_ID,
|
|
57
|
-
title: ( localize2(
|
|
59
|
+
title: ( localize2(9560, "Fix Cell Error")),
|
|
58
60
|
precondition: ( ContextKeyExpr.and(NOTEBOOK_CELL_FOCUSED, NOTEBOOK_CELL_HAS_ERROR_DIAGNOSTICS, ( NOTEBOOK_CELL_EDITOR_FOCUSED.toNegated()))),
|
|
59
61
|
f1: true
|
|
60
62
|
});
|
|
@@ -75,7 +77,11 @@ registerAction2(class extends NotebookCellAction {
|
|
|
75
77
|
const controller = InlineChatController.get(editor);
|
|
76
78
|
const message = error.name ? `${error.name}: ${error.message}` : error.message;
|
|
77
79
|
if (controller) {
|
|
78
|
-
await controller.run({
|
|
80
|
+
await controller.run({
|
|
81
|
+
message: "/fix " + message,
|
|
82
|
+
initialRange: location,
|
|
83
|
+
autoSend: true
|
|
84
|
+
});
|
|
79
85
|
}
|
|
80
86
|
}
|
|
81
87
|
}
|
|
@@ -86,7 +92,7 @@ registerAction2(class extends NotebookCellAction {
|
|
|
86
92
|
constructor() {
|
|
87
93
|
super({
|
|
88
94
|
id: EXPLAIN_CELL_ERROR_COMMAND_ID,
|
|
89
|
-
title: ( localize2(
|
|
95
|
+
title: ( localize2(9561, "Explain Cell Error")),
|
|
90
96
|
precondition: ( ContextKeyExpr.and(NOTEBOOK_CELL_FOCUSED, NOTEBOOK_CELL_HAS_ERROR_DIAGNOSTICS, ( NOTEBOOK_CELL_EDITOR_FOCUSED.toNegated()))),
|
|
91
97
|
f1: true
|
|
92
98
|
});
|
|
@@ -98,7 +104,7 @@ registerAction2(class extends NotebookCellAction {
|
|
|
98
104
|
const widgetService = accessor.get(IChatWidgetService);
|
|
99
105
|
const chatWidget = await widgetService.revealWidget();
|
|
100
106
|
const message = error.name ? `${error.name}: ${error.message}` : error.message;
|
|
101
|
-
chatWidget?.acceptInput(
|
|
107
|
+
chatWidget?.acceptInput("@workspace /explain " + message);
|
|
102
108
|
}
|
|
103
109
|
}
|
|
104
110
|
}
|
|
@@ -6,7 +6,7 @@ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
|
6
6
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
7
7
|
import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
8
8
|
import { OPEN_CELL_FAILURE_ACTIONS_COMMAND_ID } from './cellDiagnosticsActions.js';
|
|
9
|
-
import { NotebookStatusBarController } from '@codingame/monaco-vscode-
|
|
9
|
+
import { NotebookStatusBarController } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController';
|
|
10
10
|
import { registerNotebookContribution } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
|
|
11
11
|
import { CodeCellViewModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel';
|
|
12
12
|
import { CellStatusbarAlignment } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
@@ -15,17 +15,18 @@ import { ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbe
|
|
|
15
15
|
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
16
16
|
|
|
17
17
|
let DiagnosticCellStatusBarContrib = class DiagnosticCellStatusBarContrib extends Disposable {
|
|
18
|
-
static {
|
|
18
|
+
static {
|
|
19
|
+
this.id = "workbench.notebook.statusBar.diagtnostic";
|
|
20
|
+
}
|
|
19
21
|
constructor(notebookEditor, instantiationService) {
|
|
20
22
|
super();
|
|
21
|
-
this._register(( new NotebookStatusBarController(
|
|
22
|
-
|
|
23
|
-
Disposable.None
|
|
23
|
+
this._register(( new NotebookStatusBarController(
|
|
24
|
+
notebookEditor,
|
|
25
|
+
(vm, cell) => cell instanceof CodeCellViewModel ? instantiationService.createInstance(DiagnosticCellStatusBarItem, vm, cell) : Disposable.None
|
|
26
|
+
)));
|
|
24
27
|
}
|
|
25
28
|
};
|
|
26
|
-
DiagnosticCellStatusBarContrib = ( __decorate([
|
|
27
|
-
( __param(1, IInstantiationService))
|
|
28
|
-
], DiagnosticCellStatusBarContrib));
|
|
29
|
+
DiagnosticCellStatusBarContrib = ( __decorate([( __param(1, IInstantiationService))], DiagnosticCellStatusBarContrib));
|
|
29
30
|
registerNotebookContribution(DiagnosticCellStatusBarContrib.id, DiagnosticCellStatusBarContrib);
|
|
30
31
|
let DiagnosticCellStatusBarItem = class DiagnosticCellStatusBarItem extends Disposable {
|
|
31
32
|
constructor(_notebookViewModel, cell, keybindingService, chatAgentService) {
|
|
@@ -35,7 +36,9 @@ let DiagnosticCellStatusBarItem = class DiagnosticCellStatusBarItem extends Disp
|
|
|
35
36
|
this.keybindingService = keybindingService;
|
|
36
37
|
this.chatAgentService = chatAgentService;
|
|
37
38
|
this._currentItemIds = [];
|
|
38
|
-
this._register(autorun(
|
|
39
|
+
this._register(autorun(
|
|
40
|
+
reader => this.updateSparkleItem(reader.readObservable(cell.executionErrorDiagnostic))
|
|
41
|
+
));
|
|
39
42
|
}
|
|
40
43
|
hasNotebookAgent() {
|
|
41
44
|
const agents = this.chatAgentService.getAgents();
|
|
@@ -44,8 +47,7 @@ let DiagnosticCellStatusBarItem = class DiagnosticCellStatusBarItem extends Disp
|
|
|
44
47
|
async updateSparkleItem(error) {
|
|
45
48
|
let item;
|
|
46
49
|
if (error?.location && this.hasNotebookAgent()) {
|
|
47
|
-
const
|
|
48
|
-
const tooltip = ( localize(9242, "Quick Actions {0}", `(${keybinding})`));
|
|
50
|
+
const tooltip = this.keybindingService.appendKeybinding(( localize(9562, "Quick Actions")), OPEN_CELL_FAILURE_ACTIONS_COMMAND_ID);
|
|
49
51
|
item = {
|
|
50
52
|
text: `$(sparkle)`,
|
|
51
53
|
tooltip,
|
|
@@ -55,16 +57,19 @@ let DiagnosticCellStatusBarItem = class DiagnosticCellStatusBarItem extends Disp
|
|
|
55
57
|
};
|
|
56
58
|
}
|
|
57
59
|
const items = item ? [item] : [];
|
|
58
|
-
this._currentItemIds = this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds, [{
|
|
60
|
+
this._currentItemIds = this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds, [{
|
|
61
|
+
handle: this.cell.handle,
|
|
62
|
+
items
|
|
63
|
+
}]);
|
|
59
64
|
}
|
|
60
65
|
dispose() {
|
|
61
66
|
super.dispose();
|
|
62
|
-
this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds, [{
|
|
67
|
+
this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds, [{
|
|
68
|
+
handle: this.cell.handle,
|
|
69
|
+
items: []
|
|
70
|
+
}]);
|
|
63
71
|
}
|
|
64
72
|
};
|
|
65
|
-
DiagnosticCellStatusBarItem = ( __decorate([
|
|
66
|
-
( __param(2, IKeybindingService)),
|
|
67
|
-
( __param(3, IChatAgentService))
|
|
68
|
-
], DiagnosticCellStatusBarItem));
|
|
73
|
+
DiagnosticCellStatusBarItem = ( __decorate([( __param(2, IKeybindingService)), ( __param(3, IChatAgentService))], DiagnosticCellStatusBarItem));
|
|
69
74
|
|
|
70
75
|
export { DiagnosticCellStatusBarContrib };
|
|
@@ -3,12 +3,14 @@ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib
|
|
|
3
3
|
import { Throttler } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
4
4
|
import { CancellationTokenSource } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
5
5
|
import { Disposable, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
6
|
-
import { NotebookVisibleCellObserver } from '@codingame/monaco-vscode-
|
|
6
|
+
import { NotebookVisibleCellObserver } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver';
|
|
7
7
|
import { registerNotebookContribution } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
|
|
8
8
|
import { INotebookCellStatusBarService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCellStatusBarService.service';
|
|
9
9
|
|
|
10
10
|
let ContributedStatusBarItemController = class ContributedStatusBarItemController extends Disposable {
|
|
11
|
-
static {
|
|
11
|
+
static {
|
|
12
|
+
this.id = "workbench.notebook.statusBar.contributed";
|
|
13
|
+
}
|
|
12
14
|
constructor(_notebookEditor, _notebookCellStatusBarService) {
|
|
13
15
|
super();
|
|
14
16
|
this._notebookEditor = _notebookEditor;
|
|
@@ -17,8 +19,12 @@ let ContributedStatusBarItemController = class ContributedStatusBarItemControlle
|
|
|
17
19
|
this._observer = this._register(( new NotebookVisibleCellObserver(this._notebookEditor)));
|
|
18
20
|
this._register(this._observer.onDidChangeVisibleCells(this._updateVisibleCells, this));
|
|
19
21
|
this._updateEverything();
|
|
20
|
-
this._register(
|
|
21
|
-
|
|
22
|
+
this._register(
|
|
23
|
+
this._notebookCellStatusBarService.onDidChangeProviders(this._updateEverything, this)
|
|
24
|
+
);
|
|
25
|
+
this._register(
|
|
26
|
+
this._notebookCellStatusBarService.onDidChangeItems(this._updateEverything, this)
|
|
27
|
+
);
|
|
22
28
|
}
|
|
23
29
|
_updateEverything() {
|
|
24
30
|
const newCells = this._observer.visibleCells.filter(cell => !( this._visibleCells.has(cell.handle)));
|
|
@@ -26,7 +32,12 @@ let ContributedStatusBarItemController = class ContributedStatusBarItemControlle
|
|
|
26
32
|
const currentCellHandles = Array.from(( this._visibleCells.keys()));
|
|
27
33
|
const removedCells = currentCellHandles.filter(handle => !( visibleCellHandles.has(handle)));
|
|
28
34
|
const itemsToUpdate = currentCellHandles.filter(handle => ( visibleCellHandles.has(handle)));
|
|
29
|
-
this._updateVisibleCells({
|
|
35
|
+
this._updateVisibleCells({
|
|
36
|
+
added: newCells,
|
|
37
|
+
removed: ( removedCells.map(handle => ({
|
|
38
|
+
handle
|
|
39
|
+
})))
|
|
40
|
+
});
|
|
30
41
|
itemsToUpdate.forEach(handle => this._visibleCells.get(handle)?.update());
|
|
31
42
|
}
|
|
32
43
|
_updateVisibleCells(e) {
|
|
@@ -49,9 +60,7 @@ let ContributedStatusBarItemController = class ContributedStatusBarItemControlle
|
|
|
49
60
|
this._visibleCells.clear();
|
|
50
61
|
}
|
|
51
62
|
};
|
|
52
|
-
ContributedStatusBarItemController = ( __decorate([
|
|
53
|
-
( __param(1, INotebookCellStatusBarService))
|
|
54
|
-
], ContributedStatusBarItemController));
|
|
63
|
+
ContributedStatusBarItemController = ( __decorate([( __param(1, INotebookCellStatusBarService))], ContributedStatusBarItemController));
|
|
55
64
|
class CellStatusBarHelper extends Disposable {
|
|
56
65
|
constructor(_notebookViewModel, _cell, _notebookCellStatusBarService) {
|
|
57
66
|
super();
|
|
@@ -92,7 +101,10 @@ class CellStatusBarHelper extends Disposable {
|
|
|
92
101
|
return;
|
|
93
102
|
}
|
|
94
103
|
const items = ( itemLists.map(itemList => itemList.items)).flat();
|
|
95
|
-
const newIds = this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds, [{
|
|
104
|
+
const newIds = this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds, [{
|
|
105
|
+
handle: this._cell.handle,
|
|
106
|
+
items
|
|
107
|
+
}]);
|
|
96
108
|
this._currentItemLists.forEach(itemList => itemList.dispose && itemList.dispose());
|
|
97
109
|
this._currentItemLists = itemLists;
|
|
98
110
|
this._currentItemIds = newIds;
|
|
@@ -101,7 +113,10 @@ class CellStatusBarHelper extends Disposable {
|
|
|
101
113
|
super.dispose();
|
|
102
114
|
this._isDisposed = true;
|
|
103
115
|
this._activeToken?.dispose(true);
|
|
104
|
-
this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds, [{
|
|
116
|
+
this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds, [{
|
|
117
|
+
handle: this._cell.handle,
|
|
118
|
+
items: []
|
|
119
|
+
}]);
|
|
105
120
|
this._currentItemLists.forEach(itemList => itemList.dispose && itemList.dispose());
|
|
106
121
|
}
|
|
107
122
|
}
|
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js
CHANGED
|
@@ -21,7 +21,7 @@ let CellStatusBarLanguagePickerProvider = class CellStatusBarLanguagePickerProvi
|
|
|
21
21
|
constructor(_notebookService, _languageService) {
|
|
22
22
|
this._notebookService = _notebookService;
|
|
23
23
|
this._languageService = _languageService;
|
|
24
|
-
this.viewType =
|
|
24
|
+
this.viewType = "*";
|
|
25
25
|
}
|
|
26
26
|
async provideCellStatusBarItems(uri, index, _token) {
|
|
27
27
|
const doc = this._notebookService.getNotebookTextModel(uri);
|
|
@@ -32,22 +32,24 @@ let CellStatusBarLanguagePickerProvider = class CellStatusBarLanguagePickerProvi
|
|
|
32
32
|
const statusBarItems = [];
|
|
33
33
|
let displayLanguage = cell.language;
|
|
34
34
|
if (cell.cellKind === CellKind.Markup) {
|
|
35
|
-
displayLanguage =
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
35
|
+
displayLanguage = "markdown";
|
|
36
|
+
} else {
|
|
38
37
|
const registeredId = this._languageService.getLanguageIdByLanguageName(cell.language);
|
|
39
38
|
if (registeredId) {
|
|
40
39
|
displayLanguage = this._languageService.getLanguageName(displayLanguage) ?? displayLanguage;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
40
|
+
} else {
|
|
43
41
|
const searchTooltip = ( localize(
|
|
44
|
-
|
|
42
|
+
9570,
|
|
45
43
|
"Unknown cell language. Click to search for '{0}' extensions",
|
|
46
44
|
cell.language
|
|
47
45
|
));
|
|
48
46
|
statusBarItems.push({
|
|
49
47
|
text: `$(dialog-warning)`,
|
|
50
|
-
command: {
|
|
48
|
+
command: {
|
|
49
|
+
id: "workbench.extensions.search",
|
|
50
|
+
arguments: [`@tag:${cell.language}`],
|
|
51
|
+
title: "Search Extensions"
|
|
52
|
+
},
|
|
51
53
|
tooltip: searchTooltip,
|
|
52
54
|
alignment: CellStatusbarAlignment.Right,
|
|
53
55
|
priority: -Number.MAX_SAFE_INTEGER + 1
|
|
@@ -57,7 +59,7 @@ let CellStatusBarLanguagePickerProvider = class CellStatusBarLanguagePickerProvi
|
|
|
57
59
|
statusBarItems.push({
|
|
58
60
|
text: displayLanguage,
|
|
59
61
|
command: CHANGE_CELL_LANGUAGE,
|
|
60
|
-
tooltip: ( localize(
|
|
62
|
+
tooltip: ( localize(9571, "Select Cell Language Mode")),
|
|
61
63
|
alignment: CellStatusbarAlignment.Right,
|
|
62
64
|
priority: -Number.MAX_SAFE_INTEGER
|
|
63
65
|
});
|
|
@@ -66,19 +68,23 @@ let CellStatusBarLanguagePickerProvider = class CellStatusBarLanguagePickerProvi
|
|
|
66
68
|
};
|
|
67
69
|
}
|
|
68
70
|
};
|
|
69
|
-
CellStatusBarLanguagePickerProvider = ( __decorate([
|
|
70
|
-
( __param(0, INotebookService)),
|
|
71
|
-
( __param(1, ILanguageService))
|
|
72
|
-
], CellStatusBarLanguagePickerProvider));
|
|
71
|
+
CellStatusBarLanguagePickerProvider = ( __decorate([( __param(0, INotebookService)), ( __param(1, ILanguageService))], CellStatusBarLanguagePickerProvider));
|
|
73
72
|
let CellStatusBarLanguageDetectionProvider = class CellStatusBarLanguageDetectionProvider {
|
|
74
|
-
constructor(
|
|
73
|
+
constructor(
|
|
74
|
+
_notebookService,
|
|
75
|
+
_notebookKernelService,
|
|
76
|
+
_languageService,
|
|
77
|
+
_configurationService,
|
|
78
|
+
_languageDetectionService,
|
|
79
|
+
_keybindingService
|
|
80
|
+
) {
|
|
75
81
|
this._notebookService = _notebookService;
|
|
76
82
|
this._notebookKernelService = _notebookKernelService;
|
|
77
83
|
this._languageService = _languageService;
|
|
78
84
|
this._configurationService = _configurationService;
|
|
79
85
|
this._languageDetectionService = _languageDetectionService;
|
|
80
86
|
this._keybindingService = _keybindingService;
|
|
81
|
-
this.viewType =
|
|
87
|
+
this.viewType = "*";
|
|
82
88
|
this.cache = ( new ResourceMap());
|
|
83
89
|
}
|
|
84
90
|
async provideCellStatusBarItems(uri, index, token) {
|
|
@@ -87,8 +93,8 @@ let CellStatusBarLanguageDetectionProvider = class CellStatusBarLanguageDetectio
|
|
|
87
93
|
if (!cell) {
|
|
88
94
|
return;
|
|
89
95
|
}
|
|
90
|
-
const enablementConfig = this._configurationService.getValue(
|
|
91
|
-
const enabled = typeof enablementConfig ===
|
|
96
|
+
const enablementConfig = this._configurationService.getValue("workbench.editor.languageDetectionHints");
|
|
97
|
+
const enabled = typeof enablementConfig === "object" && enablementConfig?.notebookEditors;
|
|
92
98
|
if (!enabled) {
|
|
93
99
|
return;
|
|
94
100
|
}
|
|
@@ -97,14 +103,12 @@ let CellStatusBarLanguageDetectionProvider = class CellStatusBarLanguageDetectio
|
|
|
97
103
|
if (!contentVersion) {
|
|
98
104
|
return;
|
|
99
105
|
}
|
|
100
|
-
const currentLanguageId = cell.cellKind === CellKind.Markup ?
|
|
101
|
-
'markdown' :
|
|
102
|
-
(this._languageService.getLanguageIdByLanguageName(cell.language) || cell.language);
|
|
106
|
+
const currentLanguageId = cell.cellKind === CellKind.Markup ? "markdown" : (this._languageService.getLanguageIdByLanguageName(cell.language) || cell.language);
|
|
103
107
|
if (!( this.cache.has(cellUri))) {
|
|
104
108
|
this.cache.set(cellUri, {
|
|
105
109
|
cellLanguage: currentLanguageId,
|
|
106
110
|
updateTimestamp: 0,
|
|
107
|
-
contentVersion: 1
|
|
111
|
+
contentVersion: 1
|
|
108
112
|
});
|
|
109
113
|
}
|
|
110
114
|
const cached = this.cache.get(cellUri);
|
|
@@ -114,52 +118,41 @@ let CellStatusBarLanguageDetectionProvider = class CellStatusBarLanguageDetectio
|
|
|
114
118
|
cached.contentVersion = contentVersion;
|
|
115
119
|
const kernel = this._notebookKernelService.getSelectedOrSuggestedKernel(doc);
|
|
116
120
|
if (kernel) {
|
|
117
|
-
const supportedLangs = [...kernel.supportedLanguages,
|
|
121
|
+
const supportedLangs = [...kernel.supportedLanguages, "markdown"];
|
|
118
122
|
cached.guess = await this._languageDetectionService.detectLanguage(cell.uri, supportedLangs);
|
|
119
123
|
}
|
|
120
124
|
}
|
|
121
125
|
const items = [];
|
|
122
126
|
if (cached.guess && currentLanguageId !== cached.guess) {
|
|
123
127
|
const detectedName = this._languageService.getLanguageName(cached.guess) || cached.guess;
|
|
124
|
-
|
|
125
|
-
const keybinding = this._keybindingService.lookupKeybinding(DETECT_CELL_LANGUAGE);
|
|
126
|
-
const label = keybinding?.getLabel();
|
|
127
|
-
if (label) {
|
|
128
|
-
tooltip += ` (${label})`;
|
|
129
|
-
}
|
|
128
|
+
const tooltip = this._keybindingService.appendKeybinding(( localize(9572, "Accept Detected Language: {0}", detectedName)), DETECT_CELL_LANGUAGE);
|
|
130
129
|
items.push({
|
|
131
|
-
text:
|
|
130
|
+
text: "$(lightbulb-autofix)",
|
|
132
131
|
command: DETECT_CELL_LANGUAGE,
|
|
133
132
|
tooltip,
|
|
134
133
|
alignment: CellStatusbarAlignment.Right,
|
|
135
134
|
priority: -Number.MAX_SAFE_INTEGER + 1
|
|
136
135
|
});
|
|
137
136
|
}
|
|
138
|
-
return {
|
|
137
|
+
return {
|
|
138
|
+
items
|
|
139
|
+
};
|
|
139
140
|
}
|
|
140
141
|
};
|
|
141
|
-
CellStatusBarLanguageDetectionProvider = ( __decorate([
|
|
142
|
-
( __param(0, INotebookService)),
|
|
143
|
-
( __param(1, INotebookKernelService)),
|
|
144
|
-
( __param(2, ILanguageService)),
|
|
145
|
-
( __param(3, IConfigurationService)),
|
|
146
|
-
( __param(4, ILanguageDetectionService)),
|
|
147
|
-
( __param(5, IKeybindingService))
|
|
148
|
-
], CellStatusBarLanguageDetectionProvider));
|
|
142
|
+
CellStatusBarLanguageDetectionProvider = ( __decorate([( __param(0, INotebookService)), ( __param(1, INotebookKernelService)), ( __param(2, ILanguageService)), ( __param(3, IConfigurationService)), ( __param(4, ILanguageDetectionService)), ( __param(5, IKeybindingService))], CellStatusBarLanguageDetectionProvider));
|
|
149
143
|
let BuiltinCellStatusBarProviders = class BuiltinCellStatusBarProviders extends Disposable {
|
|
150
144
|
constructor(instantiationService, notebookCellStatusBarService) {
|
|
151
145
|
super();
|
|
152
146
|
const builtinProviders = [
|
|
153
147
|
CellStatusBarLanguagePickerProvider,
|
|
154
|
-
CellStatusBarLanguageDetectionProvider
|
|
148
|
+
CellStatusBarLanguageDetectionProvider
|
|
155
149
|
];
|
|
156
150
|
builtinProviders.forEach(p => {
|
|
157
|
-
this._register(
|
|
151
|
+
this._register(
|
|
152
|
+
notebookCellStatusBarService.registerCellStatusBarItemProvider(instantiationService.createInstance(p))
|
|
153
|
+
);
|
|
158
154
|
});
|
|
159
155
|
}
|
|
160
156
|
};
|
|
161
|
-
BuiltinCellStatusBarProviders = ( __decorate([
|
|
162
|
-
( __param(0, IInstantiationService)),
|
|
163
|
-
( __param(1, INotebookCellStatusBarService))
|
|
164
|
-
], BuiltinCellStatusBarProviders));
|
|
157
|
+
BuiltinCellStatusBarProviders = ( __decorate([( __param(0, IInstantiationService)), ( __param(1, INotebookCellStatusBarService))], BuiltinCellStatusBarProviders));
|
|
165
158
|
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(BuiltinCellStatusBarProviders, LifecyclePhase.Restored);
|