@codingame/monaco-vscode-notebook-service-override 13.1.7 → 14.0.1
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 +3 -3
- package/package.json +29 -28
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +8 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +25 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookCellDecorators.d.ts +60 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookCellDecorators.js +536 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatActionsOverlay.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatActionsOverlay.js +310 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatEditController.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookChatEditController.js +182 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalCellModelFactory.d.ts +21 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalCellModelFactory.js +42 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookOriginalModelRefFactory.js +72 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.d.ts +62 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizer.js +425 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.js +0 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +11 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +6 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +2 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +15 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +310 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +35 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +14 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +32 -32
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +29 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +25 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +25 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +19 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +14 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +21 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +92 -74
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +11 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +33 -33
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +2 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.d.ts +1 -1
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.d.ts +1 -1
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +16 -13
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +5 -3
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.d.ts +2 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +2 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.d.ts +9 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +5 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { CancellationTokenSource, CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
4
|
+
import { onUnexpectedExternalError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
5
|
+
import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
6
|
+
import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
|
+
import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
8
|
+
import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
9
|
+
import { format, noBreakWhitespace } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
10
|
+
import { Constants } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uint';
|
|
11
|
+
import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
|
|
12
|
+
import { InjectedTextCursorStops } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/model';
|
|
13
|
+
import { ILanguageFeaturesService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/languageFeatures';
|
|
14
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
15
|
+
import { registerAction2 } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
16
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
17
|
+
import { State } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/debug/common/debug';
|
|
18
|
+
import { IDebugService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/debug/common/debug.service';
|
|
19
|
+
import { NotebookSetting } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
20
|
+
import { NotebookExecutionType } from '@codingame/monaco-vscode-af5ccfda-af82-504b-b365-92b4e654e5c5-common/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
|
|
21
|
+
import { INotebookExecutionStateService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service';
|
|
22
|
+
import { INotebookKernelService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookKernelService.service';
|
|
23
|
+
import { NotebookAction } from '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
|
|
24
|
+
import { registerNotebookContribution } from '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
|
|
25
|
+
|
|
26
|
+
const MAX_INLINE_DECORATOR_LENGTH = 150;
|
|
27
|
+
const variableRegex = ( new RegExp(
|
|
28
|
+
'(?:[a-zA-Z_][a-zA-Z0-9_]*\\.)*' +
|
|
29
|
+
'[a-zA-Z_][a-zA-Z0-9_]*', 'g'));
|
|
30
|
+
class InlineSegment {
|
|
31
|
+
constructor(column, text) {
|
|
32
|
+
this.column = column;
|
|
33
|
+
this.text = text;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
let NotebookInlineVariablesController = class NotebookInlineVariablesController extends Disposable {
|
|
37
|
+
static { this.id = 'notebook.inlineVariablesController'; }
|
|
38
|
+
constructor(notebookEditor, notebookKernelService, notebookExecutionStateService, languageFeaturesService, configurationService, debugService) {
|
|
39
|
+
super();
|
|
40
|
+
this.notebookEditor = notebookEditor;
|
|
41
|
+
this.notebookKernelService = notebookKernelService;
|
|
42
|
+
this.notebookExecutionStateService = notebookExecutionStateService;
|
|
43
|
+
this.languageFeaturesService = languageFeaturesService;
|
|
44
|
+
this.configurationService = configurationService;
|
|
45
|
+
this.debugService = debugService;
|
|
46
|
+
this.cellDecorationIds = ( new Map());
|
|
47
|
+
this.cellContentListeners = ( new ResourceMap());
|
|
48
|
+
this.currentCancellationTokenSources = ( new ResourceMap());
|
|
49
|
+
this._register(this.notebookExecutionStateService.onDidChangeExecution(async (e) => {
|
|
50
|
+
if (!this.configurationService.getValue(NotebookSetting.notebookInlineValues)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (e.type === NotebookExecutionType.cell) {
|
|
54
|
+
await this.updateInlineVariables(e);
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
this._register(Event.runAndSubscribe(this.configurationService.onDidChangeConfiguration, e => {
|
|
58
|
+
if (!e || e.affectsConfiguration(NotebookSetting.notebookInlineValues)) {
|
|
59
|
+
if (!this.configurationService.getValue(NotebookSetting.notebookInlineValues)) {
|
|
60
|
+
this.clearNotebookInlineDecorations();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
async updateInlineVariables(event) {
|
|
66
|
+
if (event.changed) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const cell = this.notebookEditor.getCellByHandle(event.cellHandle);
|
|
70
|
+
if (!cell) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const existingSource = this.currentCancellationTokenSources.get(cell.uri);
|
|
74
|
+
if (existingSource) {
|
|
75
|
+
existingSource.cancel();
|
|
76
|
+
}
|
|
77
|
+
this.currentCancellationTokenSources.set(cell.uri, ( new CancellationTokenSource()));
|
|
78
|
+
const token = this.currentCancellationTokenSources.get(cell.uri).token;
|
|
79
|
+
if (this.debugService.state !== State.Inactive) {
|
|
80
|
+
this._clearNotebookInlineDecorations();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!this.notebookEditor.textModel?.uri || !isEqual(this.notebookEditor.textModel.uri, event.notebook)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const model = await cell.resolveTextModel();
|
|
87
|
+
if (!model) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.clearCellInlineDecorations(cell);
|
|
91
|
+
const inlineDecorations = [];
|
|
92
|
+
if (( this.languageFeaturesService.inlineValuesProvider.has(model))) {
|
|
93
|
+
const lastLine = model.getLineCount();
|
|
94
|
+
const lastColumn = model.getLineMaxColumn(lastLine);
|
|
95
|
+
const ctx = {
|
|
96
|
+
frameId: 0,
|
|
97
|
+
stoppedLocation: ( new Range(lastLine, lastColumn, lastLine, lastColumn))
|
|
98
|
+
};
|
|
99
|
+
const providers = this.languageFeaturesService.inlineValuesProvider.ordered(model).reverse();
|
|
100
|
+
const lineDecorations = ( new Map());
|
|
101
|
+
const fullCellRange = ( new Range(1, 1, lastLine, lastColumn));
|
|
102
|
+
const promises = providers.flatMap(provider => Promise.resolve(provider.provideInlineValues(model, fullCellRange, ctx, token)).then(async (result) => {
|
|
103
|
+
if (result) {
|
|
104
|
+
let kernel;
|
|
105
|
+
const kernelVars = [];
|
|
106
|
+
if (( result.some(iv => iv.type === 'variable'))) {
|
|
107
|
+
if (!this.notebookEditor.hasModel()) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
kernel = this.notebookKernelService.getMatchingKernel(this.notebookEditor.textModel);
|
|
111
|
+
const variables = kernel.selected?.provideVariables(event.notebook, undefined, 'named', 0, token);
|
|
112
|
+
if (!variables) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
for await (const v of variables) {
|
|
116
|
+
kernelVars.push(v);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
for (const iv of result) {
|
|
120
|
+
let text = undefined;
|
|
121
|
+
switch (iv.type) {
|
|
122
|
+
case 'text':
|
|
123
|
+
text = iv.text;
|
|
124
|
+
break;
|
|
125
|
+
case 'variable': {
|
|
126
|
+
const name = iv.variableName;
|
|
127
|
+
if (!name) {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const value = kernelVars.find(v => v.name === name)?.value;
|
|
131
|
+
if (!value) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
text = format('{0} = {1}', name, value);
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
case 'expression': {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (text) {
|
|
142
|
+
const line = iv.range.startLineNumber;
|
|
143
|
+
let lineSegments = lineDecorations.get(line);
|
|
144
|
+
if (!lineSegments) {
|
|
145
|
+
lineSegments = [];
|
|
146
|
+
lineDecorations.set(line, lineSegments);
|
|
147
|
+
}
|
|
148
|
+
if (!( lineSegments.some(iv => iv.text === text))) {
|
|
149
|
+
lineSegments.push(( new InlineSegment(iv.range.startColumn, text)));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}, err => {
|
|
155
|
+
onUnexpectedExternalError(err);
|
|
156
|
+
}));
|
|
157
|
+
await Promise.all(promises);
|
|
158
|
+
lineDecorations.forEach((segments, line) => {
|
|
159
|
+
if (segments.length > 0) {
|
|
160
|
+
segments = segments.sort((a, b) => a.column - b.column);
|
|
161
|
+
const text = ( segments.map(s => s.text)).join(', ');
|
|
162
|
+
inlineDecorations.push(...this.createNotebookInlineValueDecoration(line, text));
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
if (!this.notebookEditor.hasModel()) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const kernel = this.notebookKernelService.getMatchingKernel(this.notebookEditor.textModel);
|
|
171
|
+
const variables = kernel?.selected?.provideVariables(event.notebook, undefined, 'named', 0, CancellationToken.None);
|
|
172
|
+
if (!variables) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const vars = [];
|
|
176
|
+
for await (const v of variables) {
|
|
177
|
+
vars.push(v);
|
|
178
|
+
}
|
|
179
|
+
const varNames = ( vars.map(v => v.name));
|
|
180
|
+
const document = cell.textModel;
|
|
181
|
+
if (!document) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
for (let i = 1; i <= document.getLineCount(); i++) {
|
|
185
|
+
const line = document.getLineContent(i);
|
|
186
|
+
if (line.trimStart().startsWith('#')) {
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
for (let match = variableRegex.exec(line); match; match = variableRegex.exec(line)) {
|
|
190
|
+
const name = match[0];
|
|
191
|
+
if (varNames.includes(name)) {
|
|
192
|
+
const inlineVal = name + ' = ' + vars.find(v => v.name === name)?.value;
|
|
193
|
+
inlineDecorations.push(...this.createNotebookInlineValueDecoration(i, inlineVal));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
if (inlineDecorations.length > 0) {
|
|
199
|
+
this.updateCellInlineDecorations(cell, inlineDecorations);
|
|
200
|
+
this.initCellContentListener(cell);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
updateCellInlineDecorations(cell, decorations) {
|
|
204
|
+
const oldDecorations = this.cellDecorationIds.get(cell) ?? [];
|
|
205
|
+
this.cellDecorationIds.set(cell, cell.deltaModelDecorations(oldDecorations, decorations));
|
|
206
|
+
}
|
|
207
|
+
initCellContentListener(cell) {
|
|
208
|
+
const cellModel = cell.textModel;
|
|
209
|
+
if (!cellModel) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
this.cellContentListeners.set(cell.uri, cellModel.onDidChangeContent(() => {
|
|
213
|
+
this.clearCellInlineDecorations(cell);
|
|
214
|
+
}));
|
|
215
|
+
}
|
|
216
|
+
clearCellInlineDecorations(cell) {
|
|
217
|
+
const cellDecorations = this.cellDecorationIds.get(cell) ?? [];
|
|
218
|
+
if (cellDecorations) {
|
|
219
|
+
cell.deltaModelDecorations(cellDecorations, []);
|
|
220
|
+
this.cellDecorationIds.delete(cell);
|
|
221
|
+
}
|
|
222
|
+
const listener = this.cellContentListeners.get(cell.uri);
|
|
223
|
+
if (listener) {
|
|
224
|
+
listener.dispose();
|
|
225
|
+
this.cellContentListeners.delete(cell.uri);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
_clearNotebookInlineDecorations() {
|
|
229
|
+
this.cellDecorationIds.forEach((_, cell) => {
|
|
230
|
+
this.clearCellInlineDecorations(cell);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
clearNotebookInlineDecorations() {
|
|
234
|
+
this._clearNotebookInlineDecorations();
|
|
235
|
+
}
|
|
236
|
+
createNotebookInlineValueDecoration(lineNumber, contentText, column = Constants.MAX_SAFE_SMALL_INTEGER) {
|
|
237
|
+
if (contentText.length > MAX_INLINE_DECORATOR_LENGTH) {
|
|
238
|
+
contentText = contentText.substring(0, MAX_INLINE_DECORATOR_LENGTH) + '...';
|
|
239
|
+
}
|
|
240
|
+
return [
|
|
241
|
+
{
|
|
242
|
+
range: {
|
|
243
|
+
startLineNumber: lineNumber,
|
|
244
|
+
endLineNumber: lineNumber,
|
|
245
|
+
startColumn: column,
|
|
246
|
+
endColumn: column
|
|
247
|
+
},
|
|
248
|
+
options: {
|
|
249
|
+
description: 'nb-inline-value-decoration-spacer',
|
|
250
|
+
after: {
|
|
251
|
+
content: noBreakWhitespace,
|
|
252
|
+
cursorStops: InjectedTextCursorStops.None
|
|
253
|
+
},
|
|
254
|
+
showIfCollapsed: true,
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
range: {
|
|
259
|
+
startLineNumber: lineNumber,
|
|
260
|
+
endLineNumber: lineNumber,
|
|
261
|
+
startColumn: column,
|
|
262
|
+
endColumn: column
|
|
263
|
+
},
|
|
264
|
+
options: {
|
|
265
|
+
description: 'nb-inline-value-decoration',
|
|
266
|
+
after: {
|
|
267
|
+
content: this.replaceWsWithNoBreakWs(contentText),
|
|
268
|
+
inlineClassName: 'nb-inline-value',
|
|
269
|
+
inlineClassNameAffectsLetterSpacing: true,
|
|
270
|
+
cursorStops: InjectedTextCursorStops.None
|
|
271
|
+
},
|
|
272
|
+
showIfCollapsed: true,
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
];
|
|
276
|
+
}
|
|
277
|
+
replaceWsWithNoBreakWs(str) {
|
|
278
|
+
return str.replace(/[ \t]/g, noBreakWhitespace);
|
|
279
|
+
}
|
|
280
|
+
dispose() {
|
|
281
|
+
super.dispose();
|
|
282
|
+
this._clearNotebookInlineDecorations();
|
|
283
|
+
this.currentCancellationTokenSources.forEach(source => source.cancel());
|
|
284
|
+
this.currentCancellationTokenSources.clear();
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
NotebookInlineVariablesController = ( __decorate([
|
|
288
|
+
( __param(1, INotebookKernelService)),
|
|
289
|
+
( __param(2, INotebookExecutionStateService)),
|
|
290
|
+
( __param(3, ILanguageFeaturesService)),
|
|
291
|
+
( __param(4, IConfigurationService)),
|
|
292
|
+
( __param(5, IDebugService))
|
|
293
|
+
], NotebookInlineVariablesController));
|
|
294
|
+
registerNotebookContribution(NotebookInlineVariablesController.id, NotebookInlineVariablesController);
|
|
295
|
+
registerAction2(class ClearNotebookInlineValues extends NotebookAction {
|
|
296
|
+
constructor() {
|
|
297
|
+
super({
|
|
298
|
+
id: 'notebook.clearAllInlineValues',
|
|
299
|
+
title: ( localize(7537, 'Clear All Inline Values')),
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
runWithContext(accessor, context) {
|
|
303
|
+
const editor = context.notebookEditor;
|
|
304
|
+
const controller = editor.getContribution(NotebookInlineVariablesController.id);
|
|
305
|
+
controller.clearNotebookInlineDecorations();
|
|
306
|
+
return Promise.resolve();
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
export { NotebookInlineVariablesController };
|
|
@@ -11,7 +11,7 @@ import { IViewDescriptorService } from '@codingame/monaco-vscode-api/vscode/vs/w
|
|
|
11
11
|
import { VIEWLET_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/debug/common/debug';
|
|
12
12
|
import { NOTEBOOK_VARIABLE_VIEW_ENABLED } from './notebookVariableContextKeys.js';
|
|
13
13
|
import { NotebookVariablesView } from './notebookVariablesView.js';
|
|
14
|
-
import { getNotebookEditorFromEditorPane } from '@codingame/monaco-vscode-
|
|
14
|
+
import { getNotebookEditorFromEditorPane } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
15
15
|
import { variablesViewIcon } from '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
|
|
16
16
|
import { NotebookSetting } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
17
17
|
import { INotebookExecutionStateService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service';
|
|
@@ -63,7 +63,7 @@ let NotebookVariables = class NotebookVariables extends Disposable {
|
|
|
63
63
|
if (debugViewContainer) {
|
|
64
64
|
const viewsRegistry = ( Registry.as(Extensions.ViewsRegistry));
|
|
65
65
|
const viewDescriptor = {
|
|
66
|
-
id: 'workbench.notebook.variables', name: ( localize2(
|
|
66
|
+
id: 'workbench.notebook.variables', name: ( localize2(7540, "Notebook Variables")),
|
|
67
67
|
containerIcon: variablesViewIcon, ctorDescriptor: ( new SyncDescriptor(NotebookVariablesView)),
|
|
68
68
|
order: 50, weight: 5, canToggleVisibility: true, canMoveView: true, collapsed: false, when: NOTEBOOK_VARIABLE_VIEW_ENABLED
|
|
69
69
|
};
|
|
@@ -78,7 +78,7 @@ class NotebookVariableDataSource {
|
|
|
78
78
|
notebook: parent.notebook,
|
|
79
79
|
id: parent.id + `${last + 1}`,
|
|
80
80
|
extHostId: parent.extHostId,
|
|
81
|
-
name: ( localize(
|
|
81
|
+
name: ( localize(7541, "Display limit reached")),
|
|
82
82
|
value: '',
|
|
83
83
|
indexedChildrenCount: 0,
|
|
84
84
|
hasNamedChildren: false
|
|
@@ -56,10 +56,10 @@ NotebookVariableRenderer = NotebookVariableRenderer_1 = ( __decorate([
|
|
|
56
56
|
], NotebookVariableRenderer));
|
|
57
57
|
class NotebookVariableAccessibilityProvider {
|
|
58
58
|
getWidgetAriaLabel() {
|
|
59
|
-
return localize(
|
|
59
|
+
return localize(7542, "Notebook Variables");
|
|
60
60
|
}
|
|
61
61
|
getAriaLabel(element) {
|
|
62
|
-
return localize(
|
|
62
|
+
return localize(7543, "Variable {0}, value {1}", element.name, element.value);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
@@ -22,18 +22,18 @@ import { IViewDescriptorService } from '@codingame/monaco-vscode-api/vscode/vs/w
|
|
|
22
22
|
import { CONTEXT_VARIABLE_NAME, CONTEXT_VARIABLE_VALUE, CONTEXT_VARIABLE_TYPE, CONTEXT_VARIABLE_INTERFACES, CONTEXT_VARIABLE_LANGUAGE, CONTEXT_VARIABLE_EXTENSIONID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/debug/common/debug';
|
|
23
23
|
import { NotebookVariableDataSource } from './notebookVariablesDataSource.js';
|
|
24
24
|
import { NotebookVariablesDelegate, NotebookVariableRenderer, NotebookVariableAccessibilityProvider } from './notebookVariablesTree.js';
|
|
25
|
-
import { getNotebookEditorFromEditorPane } from '@codingame/monaco-vscode-
|
|
25
|
+
import { getNotebookEditorFromEditorPane } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
26
26
|
import { INotebookExecutionStateService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service';
|
|
27
27
|
import { INotebookKernelService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookKernelService.service';
|
|
28
28
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
29
|
-
import { isCompositeNotebookEditorInput } from '@codingame/monaco-vscode-
|
|
29
|
+
import { isCompositeNotebookEditorInput } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
|
|
30
30
|
|
|
31
31
|
var NotebookVariablesView_1;
|
|
32
32
|
let NotebookVariablesView = class NotebookVariablesView extends ViewPane {
|
|
33
33
|
static { NotebookVariablesView_1 = this; }
|
|
34
34
|
static { this.ID = 'notebookVariablesView'; }
|
|
35
|
-
static { this.NOTEBOOK_TITLE = ( localize2(
|
|
36
|
-
static { this.REPL_TITLE = ( localize2(
|
|
35
|
+
static { this.NOTEBOOK_TITLE = ( localize2(7544, "Notebook Variables")); }
|
|
36
|
+
static { this.REPL_TITLE = ( localize2(7545, "REPL Variables")); }
|
|
37
37
|
constructor(options, editorService, notebookKernelService, notebookExecutionStateService, keybindingService, contextMenuService, contextKeyService, configurationService, instantiationService, viewDescriptorService, openerService, quickInputService, commandService, themeService, telemetryService, hoverService, menuService) {
|
|
38
38
|
super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, hoverService);
|
|
39
39
|
this.editorService = editorService;
|
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.d.ts
CHANGED
|
@@ -7,12 +7,12 @@ import { IEditorOptions } from "@codingame/monaco-vscode-api/vscode/vs/platform/
|
|
|
7
7
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
8
8
|
import { IThemeService } from "@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service";
|
|
9
9
|
import { IEditorPane } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor";
|
|
10
|
-
import { CellFoldingState, INotebookEditorPane } from "@codingame/monaco-vscode-
|
|
10
|
+
import { CellFoldingState, INotebookEditorPane } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
|
|
11
11
|
import { NotebookEditor } from "@codingame/monaco-vscode-6f9bc782-77e0-5716-93bd-b05210c768c5-common/vscode/vs/workbench/contrib/notebook/browser/notebookEditor";
|
|
12
12
|
import { INotebookCellOutlineDataSource } from "@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource";
|
|
13
13
|
import { CellKind } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon";
|
|
14
14
|
import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
|
|
15
|
-
import { IBreadcrumbsDataSource, IOutline, IOutlineCreator, IOutlineListConfig, IQuickPickDataSource, IQuickPickOutlineElement, OutlineChangeEvent, OutlineTarget } from "@codingame/monaco-vscode-
|
|
15
|
+
import { IBreadcrumbsDataSource, IOutline, IOutlineCreator, IOutlineListConfig, IQuickPickDataSource, IQuickPickOutlineElement, OutlineChangeEvent, OutlineTarget } from "@codingame/monaco-vscode-d4a98668-f793-5361-a9cf-1e6ae6d62ce3-common/vscode/vs/workbench/services/outline/browser/outline";
|
|
16
16
|
import { IOutlineService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/outline/browser/outline.service";
|
|
17
17
|
import { OutlineEntry } from "@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/viewModel/OutlineEntry";
|
|
18
18
|
import { CancellationToken } from "@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation";
|
|
@@ -38,7 +38,6 @@ export declare class NotebookOutlinePaneProvider implements IDataSource<Notebook
|
|
|
38
38
|
private showMarkdownHeadersOnly;
|
|
39
39
|
constructor(outlineDataSourceRef: IReference<INotebookCellOutlineDataSource> | undefined, _configurationService: IConfigurationService);
|
|
40
40
|
getActiveEntry(): OutlineEntry | undefined;
|
|
41
|
-
private filterEntry;
|
|
42
41
|
getChildren(element: NotebookCellOutline | OutlineEntry): Iterable<OutlineEntry>;
|
|
43
42
|
dispose(): void;
|
|
44
43
|
}
|
|
@@ -74,7 +73,9 @@ export declare class NotebookCellOutline implements IOutline<OutlineEntry> {
|
|
|
74
73
|
private _treeDataSource;
|
|
75
74
|
private _quickPickDataSource;
|
|
76
75
|
private _breadcrumbsDataSource;
|
|
76
|
+
private outlineShowCodeCells;
|
|
77
77
|
private outlineShowCodeCellSymbols;
|
|
78
|
+
private outlineShowMarkdownHeadersOnly;
|
|
78
79
|
get activeElement(): OutlineEntry | undefined;
|
|
79
80
|
get entries(): OutlineEntry[];
|
|
80
81
|
get uri(): URI | undefined;
|
|
@@ -27,13 +27,13 @@ import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quic
|
|
|
27
27
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
|
|
28
28
|
import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
|
|
29
29
|
import { Extensions } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions';
|
|
30
|
-
import { CellFoldingState, CellRevealType } from '@codingame/monaco-vscode-
|
|
30
|
+
import { CellFoldingState, CellRevealType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
31
31
|
import { NotebookEditor } from '@codingame/monaco-vscode-6f9bc782-77e0-5716-93bd-b05210c768c5-common/vscode/vs/workbench/contrib/notebook/browser/notebookEditor';
|
|
32
32
|
import { CellKind, NotebookSetting, NotebookCellsChangeType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
33
33
|
import { SIDE_GROUP } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService';
|
|
34
34
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
35
35
|
import { LifecyclePhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
36
|
-
import { OutlineConfigKeys, OutlineTarget, OutlineConfigCollapseItemsValues } from '@codingame/monaco-vscode-
|
|
36
|
+
import { OutlineConfigKeys, OutlineTarget, OutlineConfigCollapseItemsValues } from '@codingame/monaco-vscode-d4a98668-f793-5361-a9cf-1e6ae6d62ce3-common/vscode/vs/workbench/services/outline/browser/outline';
|
|
37
37
|
import { IOutlineService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/outline/browser/outline.service';
|
|
38
38
|
import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
39
39
|
import { Range } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/range';
|
|
@@ -47,10 +47,10 @@ import { MenuEntryActionViewItem, getActionBarActions } from '@codingame/monaco-
|
|
|
47
47
|
import { disposableTimeout, Delayer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
48
48
|
import { IOutlinePane } from '@codingame/monaco-vscode-0cd5242b-7b61-5f66-ac25-ffa40baf8e8f-common/vscode/vs/workbench/contrib/outline/browser/outline';
|
|
49
49
|
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
50
|
-
import { NOTEBOOK_IS_ACTIVE_EDITOR } from '@codingame/monaco-vscode-
|
|
50
|
+
import { NOTEBOOK_IS_ACTIVE_EDITOR } from '@codingame/monaco-vscode-771c2e6d-0284-5ac1-be73-7176085eedc5-common/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
|
|
51
51
|
import { NotebookOutlineConstants } from '../../viewModel/notebookOutlineEntryFactory.js';
|
|
52
52
|
import { INotebookCellOutlineDataSourceFactory } from '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.service';
|
|
53
|
-
import { NotebookExecutionType } from '@codingame/monaco-vscode-
|
|
53
|
+
import { NotebookExecutionType } from '@codingame/monaco-vscode-af5ccfda-af82-504b-b365-92b4e654e5c5-common/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
|
|
54
54
|
import { INotebookExecutionStateService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service';
|
|
55
55
|
import { ILanguageFeaturesService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/languageFeatures';
|
|
56
56
|
|
|
@@ -315,6 +315,15 @@ NotebookQuickPickProvider = ( __decorate([
|
|
|
315
315
|
( __param(1, IConfigurationService)),
|
|
316
316
|
( __param(2, IThemeService))
|
|
317
317
|
], NotebookQuickPickProvider));
|
|
318
|
+
function filterEntry(entry, showMarkdownHeadersOnly, showCodeCells, showCodeCellSymbols) {
|
|
319
|
+
if ((showMarkdownHeadersOnly && entry.cell.cellKind === CellKind.Markup && entry.level === NotebookOutlineConstants.NonHeaderOutlineLevel) ||
|
|
320
|
+
(!showCodeCells && entry.cell.cellKind === CellKind.Code) ||
|
|
321
|
+
(!showCodeCellSymbols && entry.cell.cellKind === CellKind.Code && entry.level > NotebookOutlineConstants.NonHeaderOutlineLevel)
|
|
322
|
+
) {
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
318
327
|
let NotebookOutlinePaneProvider = class NotebookOutlinePaneProvider {
|
|
319
328
|
constructor(outlineDataSourceRef, _configurationService) {
|
|
320
329
|
this.outlineDataSourceRef = outlineDataSourceRef;
|
|
@@ -340,12 +349,12 @@ let NotebookOutlinePaneProvider = class NotebookOutlinePaneProvider {
|
|
|
340
349
|
if (!newActive) {
|
|
341
350
|
return undefined;
|
|
342
351
|
}
|
|
343
|
-
if (!
|
|
352
|
+
if (!filterEntry(newActive, this.showMarkdownHeadersOnly, this.showCodeCells, this.showCodeCellSymbols)) {
|
|
344
353
|
return newActive;
|
|
345
354
|
}
|
|
346
355
|
let parent = newActive.parent;
|
|
347
356
|
while (parent) {
|
|
348
|
-
if (
|
|
357
|
+
if (filterEntry(parent, this.showMarkdownHeadersOnly, this.showCodeCells, this.showCodeCellSymbols)) {
|
|
349
358
|
parent = parent.parent;
|
|
350
359
|
}
|
|
351
360
|
else {
|
|
@@ -354,15 +363,6 @@ let NotebookOutlinePaneProvider = class NotebookOutlinePaneProvider {
|
|
|
354
363
|
}
|
|
355
364
|
return undefined;
|
|
356
365
|
}
|
|
357
|
-
filterEntry(entry) {
|
|
358
|
-
if ((this.showMarkdownHeadersOnly && entry.cell.cellKind === CellKind.Markup && entry.level === NotebookOutlineConstants.NonHeaderOutlineLevel) ||
|
|
359
|
-
(!this.showCodeCells && entry.cell.cellKind === CellKind.Code) ||
|
|
360
|
-
(!this.showCodeCellSymbols && entry.cell.cellKind === CellKind.Code && entry.level > NotebookOutlineConstants.NonHeaderOutlineLevel)
|
|
361
|
-
) {
|
|
362
|
-
return true;
|
|
363
|
-
}
|
|
364
|
-
return false;
|
|
365
|
-
}
|
|
366
366
|
*getChildren(element) {
|
|
367
367
|
const isOutline = element instanceof NotebookCellOutline;
|
|
368
368
|
const entries = isOutline ? this.outlineDataSourceRef?.object?.entries ?? [] : element.children;
|
|
@@ -455,7 +455,12 @@ let NotebookCellOutline = class NotebookCellOutline {
|
|
|
455
455
|
return this._outlineDataSourceReference?.object?.uri;
|
|
456
456
|
}
|
|
457
457
|
get isEmpty() {
|
|
458
|
-
|
|
458
|
+
if (!this._outlineDataSourceReference?.object?.entries) {
|
|
459
|
+
return true;
|
|
460
|
+
}
|
|
461
|
+
return !( this._outlineDataSourceReference.object.entries.some(entry => {
|
|
462
|
+
return !filterEntry(entry, this.outlineShowMarkdownHeadersOnly, this.outlineShowCodeCells, this.outlineShowCodeCellSymbols);
|
|
463
|
+
}));
|
|
459
464
|
}
|
|
460
465
|
checkDelayer() {
|
|
461
466
|
if (this.delayerRecomputeState.isTriggered()) {
|
|
@@ -481,7 +486,9 @@ let NotebookCellOutline = class NotebookCellOutline {
|
|
|
481
486
|
this.delayerRecomputeState = this._disposables.add(( new Delayer(300)));
|
|
482
487
|
this.delayerRecomputeActive = this._disposables.add(( new Delayer(200)));
|
|
483
488
|
this.delayerRecomputeSymbols = this._disposables.add(( new Delayer(2000)));
|
|
489
|
+
this.outlineShowCodeCells = this._configurationService.getValue(NotebookSetting.outlineShowCodeCells);
|
|
484
490
|
this.outlineShowCodeCellSymbols = this._configurationService.getValue(NotebookSetting.outlineShowCodeCellSymbols);
|
|
491
|
+
this.outlineShowMarkdownHeadersOnly = this._configurationService.getValue(NotebookSetting.outlineShowMarkdownHeadersOnly);
|
|
485
492
|
this.initializeOutline();
|
|
486
493
|
const delegate = ( new NotebookOutlineVirtualDelegate());
|
|
487
494
|
const renderers = [this._instantiationService.createInstance(NotebookOutlineRenderer, this._editor.getControl(), this._target)];
|
|
@@ -523,6 +530,9 @@ let NotebookCellOutline = class NotebookCellOutline {
|
|
|
523
530
|
e.affectsConfiguration(NotebookSetting.outlineShowCodeCells) ||
|
|
524
531
|
e.affectsConfiguration(NotebookSetting.outlineShowCodeCellSymbols) ||
|
|
525
532
|
e.affectsConfiguration(NotebookSetting.breadcrumbsShowCodeCells)) {
|
|
533
|
+
this.outlineShowCodeCells = this._configurationService.getValue(NotebookSetting.outlineShowCodeCells);
|
|
534
|
+
this.outlineShowCodeCellSymbols = this._configurationService.getValue(NotebookSetting.outlineShowCodeCellSymbols);
|
|
535
|
+
this.outlineShowMarkdownHeadersOnly = this._configurationService.getValue(NotebookSetting.outlineShowMarkdownHeadersOnly);
|
|
526
536
|
this.delayedRecomputeState();
|
|
527
537
|
}
|
|
528
538
|
}));
|
|
@@ -718,33 +728,33 @@ const NotebookOutlineContext = {
|
|
|
718
728
|
type: 'boolean',
|
|
719
729
|
default: true,
|
|
720
730
|
markdownDescription: ( localize(
|
|
721
|
-
|
|
731
|
+
7546,
|
|
722
732
|
"When enabled, notebook outline will show only markdown cells containing a header."
|
|
723
733
|
))
|
|
724
734
|
},
|
|
725
735
|
[NotebookSetting.outlineShowCodeCells]: {
|
|
726
736
|
type: 'boolean',
|
|
727
737
|
default: false,
|
|
728
|
-
markdownDescription: ( localize(
|
|
738
|
+
markdownDescription: ( localize(7547, "When enabled, notebook outline shows code cells."))
|
|
729
739
|
},
|
|
730
740
|
[NotebookSetting.outlineShowCodeCellSymbols]: {
|
|
731
741
|
type: 'boolean',
|
|
732
742
|
default: true,
|
|
733
743
|
markdownDescription: ( localize(
|
|
734
|
-
|
|
744
|
+
7548,
|
|
735
745
|
"When enabled, notebook outline shows code cell symbols. Relies on `notebook.outline.showCodeCells` being enabled."
|
|
736
746
|
))
|
|
737
747
|
},
|
|
738
748
|
[NotebookSetting.breadcrumbsShowCodeCells]: {
|
|
739
749
|
type: 'boolean',
|
|
740
750
|
default: true,
|
|
741
|
-
markdownDescription: ( localize(
|
|
751
|
+
markdownDescription: ( localize(7549, "When enabled, notebook breadcrumbs contain code cells."))
|
|
742
752
|
},
|
|
743
753
|
[NotebookSetting.gotoSymbolsAllSymbols]: {
|
|
744
754
|
type: 'boolean',
|
|
745
755
|
default: true,
|
|
746
756
|
markdownDescription: ( localize(
|
|
747
|
-
|
|
757
|
+
7550,
|
|
748
758
|
"When enabled, the Go to Symbol Quick Pick will display full code symbols from the notebook, as well as Markdown headers."
|
|
749
759
|
))
|
|
750
760
|
},
|
|
@@ -752,7 +762,7 @@ const NotebookOutlineContext = {
|
|
|
752
762
|
});
|
|
753
763
|
MenuRegistry.appendMenuItem(MenuId.ViewTitle, {
|
|
754
764
|
submenu: MenuId.NotebookOutlineFilter,
|
|
755
|
-
title: ( localize(
|
|
765
|
+
title: ( localize(7551, "Filter Entries")),
|
|
756
766
|
icon: Codicon.filter,
|
|
757
767
|
group: 'navigation',
|
|
758
768
|
order: -1,
|
|
@@ -762,7 +772,7 @@ registerAction2(class ToggleShowMarkdownHeadersOnly extends Action2 {
|
|
|
762
772
|
constructor() {
|
|
763
773
|
super({
|
|
764
774
|
id: 'notebook.outline.toggleShowMarkdownHeadersOnly',
|
|
765
|
-
title: ( localize(
|
|
775
|
+
title: ( localize(7552, "Markdown Headers Only")),
|
|
766
776
|
f1: false,
|
|
767
777
|
toggled: {
|
|
768
778
|
condition: ( ContextKeyExpr.equals('config.notebook.outline.showMarkdownHeadersOnly', true))
|
|
@@ -783,7 +793,7 @@ registerAction2(class ToggleCodeCellEntries extends Action2 {
|
|
|
783
793
|
constructor() {
|
|
784
794
|
super({
|
|
785
795
|
id: 'notebook.outline.toggleCodeCells',
|
|
786
|
-
title: ( localize(
|
|
796
|
+
title: ( localize(7553, "Code Cells")),
|
|
787
797
|
f1: false,
|
|
788
798
|
toggled: {
|
|
789
799
|
condition: ( ContextKeyExpr.equals('config.notebook.outline.showCodeCells', true))
|
|
@@ -805,7 +815,7 @@ registerAction2(class ToggleCodeCellSymbolEntries extends Action2 {
|
|
|
805
815
|
constructor() {
|
|
806
816
|
super({
|
|
807
817
|
id: 'notebook.outline.toggleCodeCellSymbols',
|
|
808
|
-
title: ( localize(
|
|
818
|
+
title: ( localize(7554, "Code Cell Symbols")),
|
|
809
819
|
f1: false,
|
|
810
820
|
toggled: {
|
|
811
821
|
condition: ( ContextKeyExpr.equals('config.notebook.outline.showCodeCellSymbols', true))
|