@codingame/monaco-vscode-notebook-service-override 2.0.3 → 2.1.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/notebook.js +3 -1
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +22 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +10 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +0 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +18 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +118 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +20 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +32 -55
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +51 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +14 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +14 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +7 -5
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +4 -4
- package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js +10 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +5 -4
package/notebook.js
CHANGED
|
@@ -25,6 +25,7 @@ import { NotebookLoggingService } from './vscode/src/vs/workbench/contrib/notebo
|
|
|
25
25
|
import { INotebookSearchService } from 'vscode/vscode/vs/workbench/contrib/search/common/notebookSearch';
|
|
26
26
|
import { NotebookSearchService } from './vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js';
|
|
27
27
|
import './vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js';
|
|
28
|
+
import { INotebookDocumentService, NotebookDocumentWorkbenchService } from 'vscode/vscode/vs/workbench/services/notebook/common/notebookDocumentService';
|
|
28
29
|
|
|
29
30
|
function getServiceOverride() {
|
|
30
31
|
return {
|
|
@@ -40,7 +41,8 @@ function getServiceOverride() {
|
|
|
40
41
|
[( INotebookRendererMessagingService.toString())]: new SyncDescriptor(NotebookRendererMessagingService, [], true),
|
|
41
42
|
[( INotebookKeymapService.toString())]: new SyncDescriptor(NotebookKeymapService, [], true),
|
|
42
43
|
[( INotebookLoggingService.toString())]: new SyncDescriptor(NotebookLoggingService, [], true),
|
|
43
|
-
[( INotebookSearchService.toString())]: new SyncDescriptor(NotebookSearchService, [], true)
|
|
44
|
+
[( INotebookSearchService.toString())]: new SyncDescriptor(NotebookSearchService, [], true),
|
|
45
|
+
[( INotebookDocumentService.toString())]: new SyncDescriptor(NotebookDocumentWorkbenchService, [], true)
|
|
44
46
|
};
|
|
45
47
|
}
|
|
46
48
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-notebook-service-override",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@2.0
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@2.1.0",
|
|
22
22
|
"vscode-marked": "npm:marked@=3.0.2"
|
|
23
23
|
},
|
|
24
24
|
"exports": {
|
|
@@ -14,7 +14,7 @@ import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/
|
|
|
14
14
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
15
15
|
import { renderFormattedText } from 'vscode/vscode/vs/base/browser/formattedTextRenderer';
|
|
16
16
|
import { ApplyFileSnippetAction } from 'vscode/vscode/vs/workbench/contrib/snippets/browser/commands/fileTemplateSnippets';
|
|
17
|
-
import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/
|
|
17
|
+
import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService';
|
|
18
18
|
import { IInlineChatService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
19
19
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
20
20
|
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
|
|
@@ -58,6 +58,8 @@ let EmptyTextEditorHintContribution = class EmptyTextEditorHintContribution {
|
|
|
58
58
|
this.toDispose = [];
|
|
59
59
|
this.toDispose.push(this.editor.onDidChangeModel(() => this.update()));
|
|
60
60
|
this.toDispose.push(this.editor.onDidChangeModelLanguage(() => this.update()));
|
|
61
|
+
this.toDispose.push(this.editor.onDidChangeModelContent(() => this.update()));
|
|
62
|
+
this.toDispose.push(this.inlineChatService.onDidChangeProviders(() => this.update()));
|
|
61
63
|
this.toDispose.push(this.editor.onDidChangeModelDecorations(() => this.update()));
|
|
62
64
|
this.toDispose.push(this.configurationService.onDidChangeConfiguration(e => {
|
|
63
65
|
if (e.affectsConfiguration(emptyTextEditorHintSetting)) {
|
|
@@ -69,8 +71,8 @@ let EmptyTextEditorHintContribution = class EmptyTextEditorHintContribution {
|
|
|
69
71
|
this.textHintContentWidget?.dispose();
|
|
70
72
|
}
|
|
71
73
|
}));
|
|
72
|
-
this.toDispose.push(inlineChatSessionService.onDidEndSession(
|
|
73
|
-
if (this.editor === editor) {
|
|
74
|
+
this.toDispose.push(inlineChatSessionService.onDidEndSession(e => {
|
|
75
|
+
if (this.editor === e.editor) {
|
|
74
76
|
this.update();
|
|
75
77
|
}
|
|
76
78
|
}));
|
|
@@ -94,13 +96,23 @@ let EmptyTextEditorHintContribution = class EmptyTextEditorHintContribution {
|
|
|
94
96
|
if (this.inlineChatSessionService.getSession(this.editor, model.uri)) {
|
|
95
97
|
return false;
|
|
96
98
|
}
|
|
99
|
+
if (this.editor.getModel()?.getValueLength()) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
const hasConflictingDecorations = Boolean(this.editor.getLineDecorations(1)?.find((d) => d.options.beforeContentClassName
|
|
103
|
+
|| d.options.afterContentClassName
|
|
104
|
+
|| d.options.before?.content
|
|
105
|
+
|| d.options.after?.content));
|
|
106
|
+
if (hasConflictingDecorations) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
97
109
|
const inlineChatProviders = [...this.inlineChatService.getAllProvider()];
|
|
98
110
|
const shouldRenderDefaultHint = model?.uri.scheme === Schemas.untitled && languageId === PLAINTEXT_LANGUAGE_ID && !inlineChatProviders.length;
|
|
99
111
|
return inlineChatProviders.length > 0 || shouldRenderDefaultHint;
|
|
100
112
|
}
|
|
101
113
|
update() {
|
|
102
|
-
this.
|
|
103
|
-
if (this.
|
|
114
|
+
const shouldRenderHint = this._shouldRenderHint();
|
|
115
|
+
if (shouldRenderHint && !this.textHintContentWidget) {
|
|
104
116
|
this.textHintContentWidget = ( new EmptyTextEditorHintContentWidget(
|
|
105
117
|
this.editor,
|
|
106
118
|
this._getOptions(),
|
|
@@ -113,6 +125,10 @@ let EmptyTextEditorHintContribution = class EmptyTextEditorHintContribution {
|
|
|
113
125
|
this.productService
|
|
114
126
|
));
|
|
115
127
|
}
|
|
128
|
+
else if (!shouldRenderHint && this.textHintContentWidget) {
|
|
129
|
+
this.textHintContentWidget.dispose();
|
|
130
|
+
this.textHintContentWidget = undefined;
|
|
131
|
+
}
|
|
116
132
|
}
|
|
117
133
|
dispose() {
|
|
118
134
|
dispose(this.toDispose);
|
|
@@ -144,8 +160,6 @@ class EmptyTextEditorHintContentWidget {
|
|
|
144
160
|
this.isVisible = false;
|
|
145
161
|
this.ariaLabel = '';
|
|
146
162
|
this.toDispose = ( new DisposableStore());
|
|
147
|
-
this.toDispose.add(this.inlineChatService.onDidChangeProviders(() => this.onDidChangeModelContent()));
|
|
148
|
-
this.toDispose.add(this.editor.onDidChangeModelContent(() => this.onDidChangeModelContent()));
|
|
149
163
|
this.toDispose.add(this.editor.onDidChangeConfiguration((e) => {
|
|
150
164
|
if (this.domNode && e.hasChanged(50 )) {
|
|
151
165
|
this.editor.applyFontInfo(this.domNode);
|
|
@@ -157,24 +171,7 @@ class EmptyTextEditorHintContentWidget {
|
|
|
157
171
|
status(this.ariaLabel);
|
|
158
172
|
}
|
|
159
173
|
}));
|
|
160
|
-
this.
|
|
161
|
-
}
|
|
162
|
-
onDidChangeModelContent() {
|
|
163
|
-
if (!this.editor.getModel()?.getValueLength() && !this.hasConflictingDecorations()) {
|
|
164
|
-
this.editor.addContentWidget(this);
|
|
165
|
-
this.isVisible = true;
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
this.editor.removeContentWidget(this);
|
|
169
|
-
this.isVisible = false;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
hasConflictingDecorations() {
|
|
173
|
-
const res = Boolean(this.editor.getLineDecorations(1)?.find((d) => d.options.beforeContentClassName
|
|
174
|
-
|| d.options.afterContentClassName
|
|
175
|
-
|| d.options.before?.content
|
|
176
|
-
|| d.options.after?.content));
|
|
177
|
-
return res;
|
|
174
|
+
this.editor.addContentWidget(this);
|
|
178
175
|
}
|
|
179
176
|
getId() {
|
|
180
177
|
return EmptyTextEditorHintContentWidget.ID;
|
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
2
|
+
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
4
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
5
5
|
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
@@ -21,7 +21,7 @@ import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommon
|
|
|
21
21
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
22
22
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
23
23
|
import { showWindowLogActionId } from 'vscode/vscode/vs/workbench/services/log/common/logConstants';
|
|
24
|
-
import { getWindow, getActiveElement } from 'vscode/vscode/vs/base/browser/dom';
|
|
24
|
+
import { getWindow, getActiveElement, isAncestor } from 'vscode/vscode/vs/base/browser/dom';
|
|
25
25
|
|
|
26
26
|
let _logging = false;
|
|
27
27
|
function toggleLogging() {
|
|
@@ -272,7 +272,7 @@ let NotebookClipboardContribution = class NotebookClipboardContribution extends
|
|
|
272
272
|
runCopyAction(accessor) {
|
|
273
273
|
const loggerService = accessor.get(ILogService);
|
|
274
274
|
const activeElement = getActiveElement();
|
|
275
|
-
if (activeElement && ['input', 'textarea'].indexOf(activeElement.tagName.toLowerCase()) >= 0) {
|
|
275
|
+
if (activeElement instanceof HTMLElement && ['input', 'textarea'].indexOf(activeElement.tagName.toLowerCase()) >= 0) {
|
|
276
276
|
_log(loggerService, '[NotebookEditor] focus is on input or textarea element, bypass');
|
|
277
277
|
return false;
|
|
278
278
|
}
|
|
@@ -281,6 +281,10 @@ let NotebookClipboardContribution = class NotebookClipboardContribution extends
|
|
|
281
281
|
_log(loggerService, '[NotebookEditor] no active notebook editor, bypass');
|
|
282
282
|
return false;
|
|
283
283
|
}
|
|
284
|
+
if (!isAncestor(activeElement, editor.getDomNode())) {
|
|
285
|
+
_log(loggerService, '[NotebookEditor] focus is outside of the notebook editor, bypass');
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
284
288
|
if (this._focusInsideEmebedMonaco(editor)) {
|
|
285
289
|
_log(loggerService, '[NotebookEditor] focus is on embed monaco editor, bypass');
|
|
286
290
|
return false;
|
|
@@ -464,11 +468,11 @@ registerAction2(class extends Action2 {
|
|
|
464
468
|
constructor() {
|
|
465
469
|
super({
|
|
466
470
|
id: 'workbench.action.toggleNotebookClipboardLog',
|
|
467
|
-
title:
|
|
471
|
+
title: ( localize2WithPath(
|
|
468
472
|
'vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard',
|
|
469
473
|
'toggleNotebookClipboardLog',
|
|
470
|
-
|
|
471
|
-
)),
|
|
474
|
+
'Toggle Notebook Clipboard Troubleshooting'
|
|
475
|
+
)),
|
|
472
476
|
category: Categories.Developer,
|
|
473
477
|
f1: true
|
|
474
478
|
});
|
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js
CHANGED
|
@@ -7,7 +7,7 @@ import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/
|
|
|
7
7
|
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
|
|
8
8
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
9
9
|
import { EmptyTextEditorHintContribution } from '../../../../codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js';
|
|
10
|
-
import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/
|
|
10
|
+
import { IInlineChatSessionService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService';
|
|
11
11
|
import { IInlineChatService } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
12
12
|
import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
13
13
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
@@ -4,7 +4,7 @@ import { isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
|
4
4
|
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
5
5
|
import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
|
|
6
6
|
import { StartFindAction, StartFindReplaceAction, getSelectionSearchString } from 'vscode/vscode/vs/editor/contrib/find/browser/findController';
|
|
7
|
-
import {
|
|
7
|
+
import { localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
8
8
|
import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
9
9
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
10
10
|
import { NotebookFindContrib } from './notebookFindWidget.js';
|
|
@@ -19,11 +19,11 @@ registerAction2(class extends Action2 {
|
|
|
19
19
|
constructor() {
|
|
20
20
|
super({
|
|
21
21
|
id: 'notebook.hideFind',
|
|
22
|
-
title:
|
|
22
|
+
title: ( localize2WithPath(
|
|
23
23
|
'vs/workbench/contrib/notebook/browser/contrib/find/notebookFind',
|
|
24
24
|
'notebookActions.hideFind',
|
|
25
|
-
|
|
26
|
-
)),
|
|
25
|
+
'Hide Find in Notebook'
|
|
26
|
+
)),
|
|
27
27
|
keybinding: {
|
|
28
28
|
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, KEYBINDING_CONTEXT_NOTEBOOK_FIND_WIDGET_FOCUSED)),
|
|
29
29
|
primary: 9 ,
|
|
@@ -46,11 +46,11 @@ registerAction2(class extends Action2 {
|
|
|
46
46
|
constructor() {
|
|
47
47
|
super({
|
|
48
48
|
id: 'notebook.find',
|
|
49
|
-
title:
|
|
49
|
+
title: ( localize2WithPath(
|
|
50
50
|
'vs/workbench/contrib/notebook/browser/contrib/find/notebookFind',
|
|
51
51
|
'notebookActions.findInNotebook',
|
|
52
|
-
|
|
53
|
-
)),
|
|
52
|
+
'Find in Notebook'
|
|
53
|
+
)),
|
|
54
54
|
keybinding: {
|
|
55
55
|
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( ContextKeyExpr.or(NOTEBOOK_IS_ACTIVE_EDITOR, INTERACTIVE_WINDOW_IS_ACTIVE_EDITOR)), ( EditorContextKeys.focus.toNegated()))),
|
|
56
56
|
primary: 36 | 2048 ,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
2
|
+
import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
4
4
|
import { DisposableStore, Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
5
|
import { registerEditorAction, EditorAction } from 'vscode/vscode/vs/editor/browser/editorExtensions';
|
|
@@ -28,11 +28,11 @@ registerAction2(class extends Action2 {
|
|
|
28
28
|
constructor() {
|
|
29
29
|
super({
|
|
30
30
|
id: 'notebook.format',
|
|
31
|
-
title:
|
|
31
|
+
title: ( localize2WithPath(
|
|
32
32
|
'vs/workbench/contrib/notebook/browser/contrib/format/formatting',
|
|
33
33
|
'format.title',
|
|
34
|
-
|
|
35
|
-
)),
|
|
34
|
+
'Format Notebook'
|
|
35
|
+
)),
|
|
36
36
|
category: NOTEBOOK_ACTIONS_CATEGORY,
|
|
37
37
|
precondition: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_EDITOR_EDITABLE)),
|
|
38
38
|
keybinding: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
2
2
|
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
3
3
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
4
4
|
import { NOTEBOOK_ACTIONS_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
|
|
@@ -9,11 +9,11 @@ class ToggleCellToolbarPositionAction extends Action2 {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
super({
|
|
11
11
|
id: TOGGLE_CELL_TOOLBAR_POSITION,
|
|
12
|
-
title:
|
|
12
|
+
title: ( localize2WithPath(
|
|
13
13
|
'vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions',
|
|
14
14
|
'notebook.toggleCellToolbarPosition',
|
|
15
|
-
|
|
16
|
-
)),
|
|
15
|
+
'Toggle Cell Toolbar Position'
|
|
16
|
+
)),
|
|
17
17
|
menu: [{
|
|
18
18
|
id: MenuId.NotebookCellTitle,
|
|
19
19
|
group: 'View',
|
|
@@ -9,7 +9,6 @@ import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/cont
|
|
|
9
9
|
import { InputFocusedContextKey } from 'vscode/vscode/vs/platform/contextkey/common/contextkeys';
|
|
10
10
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
11
11
|
import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
|
|
12
|
-
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_LAST } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
13
12
|
import { NotebookCellAction, NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT, findTargetCellEditor, NotebookAction } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
|
|
14
13
|
import { CellEditState } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
15
14
|
import { NOTEBOOK_EDITOR_CURSOR_BOUNDARY, CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
@@ -52,16 +51,6 @@ registerAction2(class FocusNextCellAction extends NotebookCellAction {
|
|
|
52
51
|
mac: { primary: 256 | 2048 | 18 , },
|
|
53
52
|
weight: 200
|
|
54
53
|
},
|
|
55
|
-
{
|
|
56
|
-
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()), ( ContextKeyExpr.equals('config.notebook.navigation.allowNavigateToSurroundingCells', true)), ( ContextKeyExpr.and(( ContextKeyExpr.has(InputFocusedContextKey)), ( NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('top')), ( NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('none')))), CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_LAST, ( EditorContextKeys.isEmbeddedDiffEditor.negate()))),
|
|
57
|
-
primary: 18 ,
|
|
58
|
-
weight: 0
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()), ( ContextKeyExpr.equals('config.notebook.navigation.allowNavigateToSurroundingCells', true)), ( ContextKeyExpr.and(( NOTEBOOK_CELL_TYPE.isEqualTo('markup')), ( NOTEBOOK_CELL_MARKDOWN_EDIT_MODE.isEqualTo(false)), NOTEBOOK_CURSOR_NAVIGATION_MODE)), CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_LAST, ( EditorContextKeys.isEmbeddedDiffEditor.negate()))),
|
|
62
|
-
primary: 18 ,
|
|
63
|
-
weight: 0
|
|
64
|
-
},
|
|
65
54
|
{
|
|
66
55
|
when: NOTEBOOK_EDITOR_FOCUSED,
|
|
67
56
|
primary: 2048 | 512 | 12 ,
|
|
@@ -103,7 +92,6 @@ registerAction2(class FocusPreviousCellAction extends NotebookCellAction {
|
|
|
103
92
|
'cursorMoveUp',
|
|
104
93
|
'Focus Previous Cell Editor'
|
|
105
94
|
)),
|
|
106
|
-
precondition: ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()),
|
|
107
95
|
keybinding: [
|
|
108
96
|
{
|
|
109
97
|
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()), ( ContextKeyExpr.equals('config.notebook.navigation.allowNavigateToSurroundingCells', true)), ( ContextKeyExpr.and(( ContextKeyExpr.has(InputFocusedContextKey)), EditorContextKeys.editorTextFocus, ( NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('bottom')), ( NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('none')))), ( EditorContextKeys.isEmbeddedDiffEditor.negate()))),
|
|
@@ -11,19 +11,25 @@ import { NOTEBOOK_KERNEL } from 'vscode/vscode/vs/workbench/contrib/notebook/com
|
|
|
11
11
|
import { variablesViewIcon } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
|
|
12
12
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
13
13
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
14
|
+
import { INotebookExecutionStateService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
|
|
15
|
+
import { NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
14
16
|
|
|
15
17
|
let NotebookVariables = class NotebookVariables extends Disposable {
|
|
16
|
-
constructor(editorService, configurationService) {
|
|
18
|
+
constructor(editorService, configurationService, notebookExecutionStateService) {
|
|
17
19
|
super();
|
|
18
20
|
this.editorService = editorService;
|
|
19
|
-
this.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
this.notebookExecutionStateService = notebookExecutionStateService;
|
|
22
|
+
this.listeners = [];
|
|
23
|
+
this.listeners.push(this.editorService.onDidEditorsChange(() => this.handleInitEvent(configurationService)));
|
|
24
|
+
this.listeners.push(this.notebookExecutionStateService.onDidChangeExecution(() => this.handleInitEvent(configurationService)));
|
|
25
|
+
}
|
|
26
|
+
handleInitEvent(configurationService) {
|
|
27
|
+
if (configurationService.getValue(NotebookSetting.notebookVariablesView)
|
|
28
|
+
&& this.editorService.activeEditorPane?.getId() === 'workbench.editor.notebook') {
|
|
29
|
+
if (this.initializeView()) {
|
|
30
|
+
this.listeners.forEach(listener => listener.dispose());
|
|
25
31
|
}
|
|
26
|
-
}
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
34
|
initializeView() {
|
|
29
35
|
const debugViewContainer = ( Registry.as('workbench.registry.view.containers')).get(VIEWLET_ID);
|
|
@@ -34,7 +40,8 @@ let NotebookVariables = class NotebookVariables extends Disposable {
|
|
|
34
40
|
'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables',
|
|
35
41
|
'notebookVariables',
|
|
36
42
|
"Notebook Variables"
|
|
37
|
-
)),
|
|
43
|
+
)),
|
|
44
|
+
containerIcon: variablesViewIcon, ctorDescriptor: ( new SyncDescriptor(NotebookVariablesView)),
|
|
38
45
|
order: 50, weight: 5, canToggleVisibility: true, canMoveView: true, collapsed: true, when: ( ContextKeyExpr.notEquals(NOTEBOOK_KERNEL.key, '')),
|
|
39
46
|
};
|
|
40
47
|
viewsRegistry.registerViews([viewDescriptor], debugViewContainer);
|
|
@@ -45,7 +52,8 @@ let NotebookVariables = class NotebookVariables extends Disposable {
|
|
|
45
52
|
};
|
|
46
53
|
NotebookVariables = ( __decorate([
|
|
47
54
|
( __param(0, IEditorService)),
|
|
48
|
-
( __param(1, IConfigurationService))
|
|
55
|
+
( __param(1, IConfigurationService)),
|
|
56
|
+
( __param(2, INotebookExecutionStateService))
|
|
49
57
|
], NotebookVariables));
|
|
50
58
|
|
|
51
59
|
export { NotebookVariables };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
2
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
+
import { variablePageSize } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService';
|
|
4
|
+
|
|
5
|
+
class NotebookVariableDataSource {
|
|
6
|
+
constructor(notebookKernelService) {
|
|
7
|
+
this.notebookKernelService = notebookKernelService;
|
|
8
|
+
this.cancellationTokenSource = ( new CancellationTokenSource());
|
|
9
|
+
}
|
|
10
|
+
hasChildren(element) {
|
|
11
|
+
return element.kind === 'root' || element.hasNamedChildren || element.indexedChildrenCount > 0;
|
|
12
|
+
}
|
|
13
|
+
cancel() {
|
|
14
|
+
this.cancellationTokenSource.cancel();
|
|
15
|
+
this.cancellationTokenSource.dispose();
|
|
16
|
+
this.cancellationTokenSource = ( new CancellationTokenSource());
|
|
17
|
+
}
|
|
18
|
+
async getChildren(element) {
|
|
19
|
+
if (element.kind === 'root') {
|
|
20
|
+
return this.getRootVariables(element.notebook);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return this.getVariables(element);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async getVariables(parent) {
|
|
27
|
+
const selectedKernel = this.notebookKernelService.getMatchingKernel(parent.notebook).selected;
|
|
28
|
+
if (selectedKernel && selectedKernel.hasVariableProvider) {
|
|
29
|
+
let children = [];
|
|
30
|
+
if (parent.hasNamedChildren) {
|
|
31
|
+
const variables = selectedKernel.provideVariables(parent.notebook.uri, parent.extHostId, 'named', 0, this.cancellationTokenSource.token);
|
|
32
|
+
const childNodes = await ( variables
|
|
33
|
+
.map(
|
|
34
|
+
variable => { return this.createVariableElement(variable, parent.notebook); }
|
|
35
|
+
))
|
|
36
|
+
.toPromise();
|
|
37
|
+
children = children.concat(childNodes);
|
|
38
|
+
}
|
|
39
|
+
if (parent.indexedChildrenCount > 0) {
|
|
40
|
+
const childNodes = await this.getIndexedChildren(parent, selectedKernel);
|
|
41
|
+
children = children.concat(childNodes);
|
|
42
|
+
}
|
|
43
|
+
return children;
|
|
44
|
+
}
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
async getIndexedChildren(parent, kernel) {
|
|
48
|
+
const childNodes = [];
|
|
49
|
+
if (parent.indexedChildrenCount > variablePageSize) {
|
|
50
|
+
const indexedChildCountLimit = 100000;
|
|
51
|
+
const limit = Math.min(parent.indexedChildrenCount, indexedChildCountLimit);
|
|
52
|
+
for (let start = 0; start < limit; start += variablePageSize) {
|
|
53
|
+
let end = start + variablePageSize;
|
|
54
|
+
if (end > limit) {
|
|
55
|
+
end = limit;
|
|
56
|
+
}
|
|
57
|
+
childNodes.push({
|
|
58
|
+
kind: 'variable',
|
|
59
|
+
notebook: parent.notebook,
|
|
60
|
+
id: parent.id + `${start}`,
|
|
61
|
+
extHostId: parent.extHostId,
|
|
62
|
+
name: `[${start}..${end - 1}]`,
|
|
63
|
+
value: '',
|
|
64
|
+
indexedChildrenCount: end - start,
|
|
65
|
+
indexStart: start,
|
|
66
|
+
hasNamedChildren: false
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
if (parent.indexedChildrenCount > indexedChildCountLimit) {
|
|
70
|
+
childNodes.push({
|
|
71
|
+
kind: 'variable',
|
|
72
|
+
notebook: parent.notebook,
|
|
73
|
+
id: parent.id + `${limit + 1}`,
|
|
74
|
+
extHostId: parent.extHostId,
|
|
75
|
+
name: ( localizeWithPath(
|
|
76
|
+
'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource',
|
|
77
|
+
'notebook.indexedChildrenLimitReached',
|
|
78
|
+
"Display limit reached"
|
|
79
|
+
)),
|
|
80
|
+
value: '',
|
|
81
|
+
indexedChildrenCount: 0,
|
|
82
|
+
hasNamedChildren: false
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else if (parent.indexedChildrenCount > 0) {
|
|
87
|
+
const variables = kernel.provideVariables(parent.notebook.uri, parent.extHostId, 'indexed', parent.indexStart ?? 0, this.cancellationTokenSource.token);
|
|
88
|
+
for await (const variable of variables) {
|
|
89
|
+
childNodes.push(this.createVariableElement(variable, parent.notebook));
|
|
90
|
+
if (childNodes.length >= variablePageSize) {
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return childNodes;
|
|
96
|
+
}
|
|
97
|
+
async getRootVariables(notebook) {
|
|
98
|
+
const selectedKernel = this.notebookKernelService.getMatchingKernel(notebook).selected;
|
|
99
|
+
if (selectedKernel && selectedKernel.hasVariableProvider) {
|
|
100
|
+
const variables = selectedKernel.provideVariables(notebook.uri, undefined, 'named', 0, this.cancellationTokenSource.token);
|
|
101
|
+
return await ( variables
|
|
102
|
+
.map(variable => { return this.createVariableElement(variable, notebook); }))
|
|
103
|
+
.toPromise();
|
|
104
|
+
}
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
createVariableElement(variable, notebook) {
|
|
108
|
+
return {
|
|
109
|
+
...variable,
|
|
110
|
+
kind: 'variable',
|
|
111
|
+
notebook,
|
|
112
|
+
extHostId: variable.id,
|
|
113
|
+
id: `${variable.id}`
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { NotebookVariableDataSource };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { append, $ } from 'vscode/vscode/vs/base/browser/dom';
|
|
1
|
+
import { append, $ as $$1 } from 'vscode/vscode/vs/base/browser/dom';
|
|
2
2
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
+
import { renderExpressionValue } from 'vscode/vscode/vs/workbench/contrib/debug/browser/baseDebugView';
|
|
3
4
|
|
|
5
|
+
const $ = $$1;
|
|
6
|
+
const MAX_VALUE_RENDER_LENGTH_IN_VIEWLET = 1024;
|
|
4
7
|
class NotebookVariablesDelegate {
|
|
5
8
|
getHeight(element) {
|
|
6
9
|
return 22;
|
|
@@ -15,11 +18,21 @@ class NotebookVariableRenderer {
|
|
|
15
18
|
return NotebookVariableRenderer.ID;
|
|
16
19
|
}
|
|
17
20
|
renderTemplate(container) {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const expression = append(container, $('.expression'));
|
|
22
|
+
const name = append(expression, $('span.name'));
|
|
23
|
+
const value = append(expression, $('span.value'));
|
|
24
|
+
const template = { expression, name, value };
|
|
25
|
+
return template;
|
|
26
|
+
}
|
|
27
|
+
renderElement(element, _index, data) {
|
|
28
|
+
const text = element.element.value.trim() !== '' ? `${element.element.name}:` : element.element.name;
|
|
29
|
+
data.name.textContent = text;
|
|
30
|
+
data.name.title = element.element.type ?? '';
|
|
31
|
+
renderExpressionValue(element.element, data.value, {
|
|
32
|
+
colorize: true,
|
|
33
|
+
showHover: true,
|
|
34
|
+
maxValueLength: MAX_VALUE_RENDER_LENGTH_IN_VIEWLET
|
|
35
|
+
});
|
|
23
36
|
}
|
|
24
37
|
disposeTemplate() {
|
|
25
38
|
}
|
|
@@ -37,7 +50,7 @@ class NotebookVariableAccessibilityProvider {
|
|
|
37
50
|
'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree',
|
|
38
51
|
'notebookVariableAriaLabel',
|
|
39
52
|
"Variable {0}, value {1}",
|
|
40
|
-
element.
|
|
53
|
+
element.name,
|
|
41
54
|
element.value
|
|
42
55
|
));
|
|
43
56
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import {
|
|
2
|
+
import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
|
|
3
3
|
import { localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
4
4
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
5
5
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
@@ -7,13 +7,14 @@ import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/
|
|
|
7
7
|
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
|
|
8
8
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
9
9
|
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
10
|
-
import {
|
|
10
|
+
import { WorkbenchAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
11
11
|
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
12
12
|
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
13
13
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
14
14
|
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
15
15
|
import { ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
16
16
|
import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
|
|
17
|
+
import { NotebookVariableDataSource } from './notebookVariablesDataSource.js';
|
|
17
18
|
import { NotebookVariablesDelegate, NotebookVariableRenderer, NotebookVariableAccessibilityProvider } from './notebookVariablesTree.js';
|
|
18
19
|
import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
19
20
|
import { INotebookExecutionStateService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
|
|
@@ -34,85 +35,61 @@ let NotebookVariablesView = class NotebookVariablesView extends ViewPane {
|
|
|
34
35
|
this.notebookExecutionStateService = notebookExecutionStateService;
|
|
35
36
|
this.quickInputService = quickInputService;
|
|
36
37
|
this.commandService = commandService;
|
|
37
|
-
this.index = 0;
|
|
38
38
|
this._register(this.editorService.onDidActiveEditorChange(this.handleActiveEditorChange.bind(this)));
|
|
39
|
-
this._register(this.notebookExecutionStateService.onDidChangeExecution(this.handleExecutionStateChange.bind(this)));
|
|
40
39
|
this._register(this.notebookKernelService.onDidNotebookVariablesUpdate(this.handleVariablesChanged.bind(this)));
|
|
40
|
+
this._register(this.notebookExecutionStateService.onDidChangeExecution(this.handleExecutionStateChange.bind(this)));
|
|
41
|
+
this.setActiveNotebook();
|
|
42
|
+
this.dataSource = ( new NotebookVariableDataSource(this.notebookKernelService));
|
|
43
|
+
this.updateScheduler = ( new RunOnceScheduler(() => this.tree?.updateChildren(), 100));
|
|
41
44
|
}
|
|
42
45
|
renderBody(container) {
|
|
43
46
|
super.renderBody(container);
|
|
44
|
-
this.tree = this.instantiationService.createInstance(
|
|
45
|
-
identityProvider: { getId: (e) => e.id },
|
|
46
|
-
horizontalScrolling: false,
|
|
47
|
-
supportDynamicHeights: true,
|
|
48
|
-
hideTwistiesOfChildlessElements: true,
|
|
47
|
+
this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'notebookVariablesTree', container, ( new NotebookVariablesDelegate()), [( new NotebookVariableRenderer())], this.dataSource, {
|
|
49
48
|
accessibilityProvider: ( new NotebookVariableAccessibilityProvider()),
|
|
50
|
-
|
|
49
|
+
identityProvider: { getId: (e) => e.id },
|
|
51
50
|
});
|
|
52
51
|
this.tree.layout();
|
|
53
|
-
this.
|
|
52
|
+
if (this.activeNotebook) {
|
|
53
|
+
this.tree.setInput({ kind: 'root', notebook: this.activeNotebook });
|
|
54
|
+
}
|
|
54
55
|
}
|
|
55
56
|
layoutBody(height, width) {
|
|
56
57
|
super.layoutBody(height, width);
|
|
57
58
|
this.tree?.layout(height, width);
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
+
setActiveNotebook() {
|
|
61
|
+
const current = this.activeNotebook;
|
|
60
62
|
const activeEditorPane = this.editorService.activeEditorPane;
|
|
61
63
|
if (activeEditorPane && activeEditorPane.getId() === 'workbench.editor.notebook') {
|
|
62
64
|
const notebookDocument = getNotebookEditorFromEditorPane(activeEditorPane)?.getViewModel()?.notebookDocument;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
this.activeNotebook = notebookDocument;
|
|
66
|
+
}
|
|
67
|
+
return current !== this.activeNotebook;
|
|
68
|
+
}
|
|
69
|
+
handleActiveEditorChange() {
|
|
70
|
+
if (this.setActiveNotebook() && this.activeNotebook) {
|
|
71
|
+
this.tree?.setInput({ kind: 'root', notebook: this.activeNotebook });
|
|
72
|
+
this.updateScheduler.schedule();
|
|
67
73
|
}
|
|
68
74
|
}
|
|
69
75
|
handleExecutionStateChange(event) {
|
|
70
76
|
if (this.activeNotebook) {
|
|
71
|
-
if (event.
|
|
72
|
-
this.
|
|
77
|
+
if (event.affectsNotebook(this.activeNotebook.uri)) {
|
|
78
|
+
this.dataSource.cancel();
|
|
79
|
+
if (event.changed === undefined) {
|
|
80
|
+
this.updateScheduler.schedule();
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
this.updateScheduler.cancel();
|
|
84
|
+
}
|
|
73
85
|
}
|
|
74
86
|
}
|
|
75
87
|
}
|
|
76
88
|
handleVariablesChanged(notebookUri) {
|
|
77
89
|
if (this.activeNotebook && ( notebookUri.toString()) === ( this.activeNotebook.uri.toString())) {
|
|
78
|
-
this.
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
async updateVariables(notebook) {
|
|
82
|
-
const selectedKernel = this.notebookKernelService.getMatchingKernel(notebook).selected;
|
|
83
|
-
if (selectedKernel && selectedKernel.hasVariableProvider) {
|
|
84
|
-
const variables = selectedKernel.provideVariables(notebook.uri, undefined, 'named', 0, CancellationToken.None);
|
|
85
|
-
const treeData = await ( variables
|
|
86
|
-
.map(variable => { return this.createTreeItem(variable); }))
|
|
87
|
-
.toPromise();
|
|
88
|
-
this.tree?.setChildren(null, treeData);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
createTreeItem(variable) {
|
|
92
|
-
let collapsed = undefined;
|
|
93
|
-
let children = undefined;
|
|
94
|
-
if (variable.namedChildrenCount > 0 || variable.indexedChildrenCount > 0) {
|
|
95
|
-
collapsed = true;
|
|
96
|
-
children = [
|
|
97
|
-
{
|
|
98
|
-
element: {
|
|
99
|
-
id: `${this.index + 1}-placeholder`,
|
|
100
|
-
label: ' ',
|
|
101
|
-
value: 'loading...',
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
];
|
|
90
|
+
this.tree?.setInput({ kind: 'root', notebook: this.activeNotebook });
|
|
91
|
+
this.updateScheduler.schedule();
|
|
105
92
|
}
|
|
106
|
-
const element = {
|
|
107
|
-
element: {
|
|
108
|
-
id: `${this.index++}`,
|
|
109
|
-
label: variable.variable.name,
|
|
110
|
-
value: variable.variable.value,
|
|
111
|
-
},
|
|
112
|
-
children,
|
|
113
|
-
collapsed
|
|
114
|
-
};
|
|
115
|
-
return element;
|
|
116
93
|
}
|
|
117
94
|
};
|
|
118
95
|
NotebookVariablesView = ( __decorate([
|
|
@@ -370,7 +370,7 @@ NotebookOutlineCreator = ( __decorate([
|
|
|
370
370
|
},
|
|
371
371
|
[NotebookSetting.gotoSymbolsAllSymbols]: {
|
|
372
372
|
type: 'boolean',
|
|
373
|
-
default:
|
|
373
|
+
default: true,
|
|
374
374
|
markdownDescription: ( localizeWithPath(
|
|
375
375
|
'vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline',
|
|
376
376
|
'notebook.gotoSymbols.showAllSymbols',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
2
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
2
|
+
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
4
4
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
5
5
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
@@ -108,11 +108,11 @@ registerAction2(class ToggleLineNumberFromEditorTitle extends Action2 {
|
|
|
108
108
|
constructor() {
|
|
109
109
|
super({
|
|
110
110
|
id: 'notebook.toggleLineNumbersFromEditorTitle',
|
|
111
|
-
title:
|
|
111
|
+
title: ( localize2WithPath(
|
|
112
112
|
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
113
113
|
'notebook.toggleLineNumbers',
|
|
114
|
-
|
|
115
|
-
)),
|
|
114
|
+
'Toggle Notebook Line Numbers'
|
|
115
|
+
)),
|
|
116
116
|
precondition: NOTEBOOK_EDITOR_FOCUSED,
|
|
117
117
|
menu: [
|
|
118
118
|
{
|
|
@@ -142,11 +142,11 @@ registerAction2(class ToggleCellToolbarPositionFromEditorTitle extends Action2 {
|
|
|
142
142
|
constructor() {
|
|
143
143
|
super({
|
|
144
144
|
id: 'notebook.toggleCellToolbarPositionFromEditorTitle',
|
|
145
|
-
title:
|
|
145
|
+
title: ( localize2WithPath(
|
|
146
146
|
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
147
147
|
'notebook.toggleCellToolbarPosition',
|
|
148
|
-
|
|
149
|
-
)),
|
|
148
|
+
'Toggle Cell Toolbar Position'
|
|
149
|
+
)),
|
|
150
150
|
menu: [{
|
|
151
151
|
id: MenuId.NotebookEditorLayoutConfigure,
|
|
152
152
|
group: 'notebookLayoutDetails',
|
|
@@ -164,11 +164,11 @@ registerAction2(class ToggleBreadcrumbFromEditorTitle extends Action2 {
|
|
|
164
164
|
constructor() {
|
|
165
165
|
super({
|
|
166
166
|
id: 'breadcrumbs.toggleFromEditorTitle',
|
|
167
|
-
title:
|
|
167
|
+
title: ( localize2WithPath(
|
|
168
168
|
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
169
169
|
'notebook.toggleBreadcrumb',
|
|
170
|
-
|
|
171
|
-
)),
|
|
170
|
+
'Toggle Breadcrumbs'
|
|
171
|
+
)),
|
|
172
172
|
menu: [{
|
|
173
173
|
id: MenuId.NotebookEditorLayoutConfigure,
|
|
174
174
|
group: 'notebookLayoutDetails',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IBulkEditService, ResourceTextEdit } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
|
|
2
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
2
|
+
import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
4
4
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
5
5
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
@@ -19,11 +19,11 @@ registerAction2(class extends Action2 {
|
|
|
19
19
|
super({
|
|
20
20
|
id: 'notebook.diff.switchToText',
|
|
21
21
|
icon: openAsTextIcon,
|
|
22
|
-
title:
|
|
22
|
+
title: ( localize2WithPath(
|
|
23
23
|
'vs/workbench/contrib/notebook/browser/diff/notebookDiffActions',
|
|
24
24
|
'notebook.diff.switchToText',
|
|
25
|
-
|
|
26
|
-
)),
|
|
25
|
+
'Open Text Diff Editor'
|
|
26
|
+
)),
|
|
27
27
|
precondition: ( ActiveEditorContext.isEqualTo(NotebookTextDiffEditor.ID)),
|
|
28
28
|
menu: [{
|
|
29
29
|
id: MenuId.EditorTitle,
|
|
@@ -206,20 +206,20 @@ class ToggleRenderAction extends Action2 {
|
|
|
206
206
|
}
|
|
207
207
|
registerAction2(class extends ToggleRenderAction {
|
|
208
208
|
constructor() {
|
|
209
|
-
super('notebook.diff.showOutputs',
|
|
209
|
+
super('notebook.diff.showOutputs', ( localize2WithPath(
|
|
210
210
|
'vs/workbench/contrib/notebook/browser/diff/notebookDiffActions',
|
|
211
211
|
'notebook.diff.showOutputs',
|
|
212
|
-
|
|
213
|
-
)),
|
|
212
|
+
'Show Outputs Differences'
|
|
213
|
+
)), ( ActiveEditorContext.isEqualTo(NotebookTextDiffEditor.ID)), ( ContextKeyExpr.notEquals('config.notebook.diff.ignoreOutputs', true)), 2, true, undefined);
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
216
|
registerAction2(class extends ToggleRenderAction {
|
|
217
217
|
constructor() {
|
|
218
|
-
super('notebook.diff.showMetadata',
|
|
218
|
+
super('notebook.diff.showMetadata', ( localize2WithPath(
|
|
219
219
|
'vs/workbench/contrib/notebook/browser/diff/notebookDiffActions',
|
|
220
220
|
'notebook.diff.showMetadata',
|
|
221
|
-
|
|
222
|
-
)),
|
|
221
|
+
'Show Metadata Differences'
|
|
222
|
+
)), ( ActiveEditorContext.isEqualTo(NotebookTextDiffEditor.ID)), ( ContextKeyExpr.notEquals('config.notebook.diff.ignoreMetadata', true)), 1, undefined, true);
|
|
223
223
|
}
|
|
224
224
|
});
|
|
225
225
|
registerAction2(class extends Action2 {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
2
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
-
import { append, $ as $$1, addStandardDisposableGenericMouseDownListener, addStandardDisposableGenericMouseUpListener, scheduleAtNextAnimationFrame, getWindow } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
+
import { append, $ as $$1, addStandardDisposableGenericMouseDownListener, addStandardDisposableGenericMouseUpListener, getActiveWindow, scheduleAtNextAnimationFrame, getWindow } from 'vscode/vscode/vs/base/browser/dom';
|
|
4
4
|
import { findLastIdx } from 'vscode/vscode/vs/base/common/arraysFind';
|
|
5
5
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
6
6
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
@@ -356,7 +356,7 @@ let NotebookTextDiffEditor = class NotebookTextDiffEditor extends EditorPane {
|
|
|
356
356
|
fontFamily: this._generateFontFamily()
|
|
357
357
|
}, undefined);
|
|
358
358
|
this._list.rowsContainer.insertAdjacentElement('afterbegin', this._modifiedWebview.element);
|
|
359
|
-
this._modifiedWebview.createWebview();
|
|
359
|
+
this._modifiedWebview.createWebview(getActiveWindow());
|
|
360
360
|
this._modifiedWebview.element.style.width = `calc(50% - 16px)`;
|
|
361
361
|
this._modifiedWebview.element.style.left = `calc(50%)`;
|
|
362
362
|
}
|
|
@@ -370,7 +370,7 @@ let NotebookTextDiffEditor = class NotebookTextDiffEditor extends EditorPane {
|
|
|
370
370
|
fontFamily: this._generateFontFamily()
|
|
371
371
|
}, undefined);
|
|
372
372
|
this._list.rowsContainer.insertAdjacentElement('afterbegin', this._originalWebview.element);
|
|
373
|
-
this._originalWebview.createWebview();
|
|
373
|
+
this._originalWebview.createWebview(getActiveWindow());
|
|
374
374
|
this._originalWebview.element.style.width = `calc(50% - 16px)`;
|
|
375
375
|
this._originalWebview.element.style.left = `16px`;
|
|
376
376
|
}
|
|
@@ -371,11 +371,11 @@ let NotebookTextDiffList = class NotebookTextDiffList extends WorkbenchList {
|
|
|
371
371
|
if (styles.listHoverOutline) {
|
|
372
372
|
content.push(`.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover { outline: 1px dashed ${styles.listHoverOutline}; outline-offset: -1px; }`);
|
|
373
373
|
}
|
|
374
|
-
if (styles.
|
|
374
|
+
if (styles.listDropOverBackground) {
|
|
375
375
|
content.push(`
|
|
376
376
|
.monaco-list${suffix}.drop-target,
|
|
377
377
|
.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-rows.drop-target,
|
|
378
|
-
.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-row.drop-target { background-color: ${styles.
|
|
378
|
+
.monaco-list${suffix} > div.monaco-scrollable-element > .monaco-list-row.drop-target { background-color: ${styles.listDropOverBackground} !important; color: inherit !important; }
|
|
379
379
|
`);
|
|
380
380
|
}
|
|
381
381
|
const newStyles = content.join('\n');
|
|
@@ -536,11 +536,12 @@ class NotebookAccessibilityHelpContribution extends Disposable {
|
|
|
536
536
|
constructor() {
|
|
537
537
|
super();
|
|
538
538
|
this._register(AccessibilityHelpAction.addImplementation(105, 'notebook', async (accessor) => {
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
|
|
539
|
+
const activeEditor = accessor.get(ICodeEditorService).getActiveCodeEditor()
|
|
540
|
+
|| accessor.get(ICodeEditorService).getFocusedCodeEditor()
|
|
541
|
+
|| accessor.get(IEditorService).activeEditorPane;
|
|
542
|
+
if (activeEditor) {
|
|
543
|
+
runAccessibilityHelpAction(accessor, activeEditor);
|
|
542
544
|
}
|
|
543
|
-
runAccessibilityHelpAction(accessor, codeEditor);
|
|
544
545
|
}, NOTEBOOK_IS_ACTIVE_EDITOR));
|
|
545
546
|
}
|
|
546
547
|
}
|
|
@@ -775,16 +776,39 @@ configurationRegistry.registerConfiguration({
|
|
|
775
776
|
default: true,
|
|
776
777
|
tags: ['notebookLayout']
|
|
777
778
|
},
|
|
778
|
-
[NotebookSetting.
|
|
779
|
+
[NotebookSetting.stickyScrollEnabled]: {
|
|
779
780
|
description: ( localizeWithPath(
|
|
780
781
|
'vs/workbench/contrib/notebook/browser/notebook.contribution',
|
|
781
|
-
'notebook.
|
|
782
|
+
'notebook.stickyScrollEnabled.description',
|
|
782
783
|
"Experimental. Control whether to render notebook Sticky Scroll headers in the notebook editor."
|
|
783
784
|
)),
|
|
784
785
|
type: 'boolean',
|
|
785
786
|
default: false,
|
|
786
787
|
tags: ['notebookLayout']
|
|
787
788
|
},
|
|
789
|
+
[NotebookSetting.stickyScrollMode]: {
|
|
790
|
+
description: ( localizeWithPath(
|
|
791
|
+
'vs/workbench/contrib/notebook/browser/notebook.contribution',
|
|
792
|
+
'notebook.stickyScrollMode.description',
|
|
793
|
+
"Control whether nested sticky lines appear to stack flat or indented."
|
|
794
|
+
)),
|
|
795
|
+
type: 'string',
|
|
796
|
+
enum: ['flat', 'indented'],
|
|
797
|
+
enumDescriptions: [
|
|
798
|
+
( localizeWithPath(
|
|
799
|
+
'vs/workbench/contrib/notebook/browser/notebook.contribution',
|
|
800
|
+
'notebook.stickyScrollMode.flat',
|
|
801
|
+
"Nested sticky lines appear flat."
|
|
802
|
+
)),
|
|
803
|
+
( localizeWithPath(
|
|
804
|
+
'vs/workbench/contrib/notebook/browser/notebook.contribution',
|
|
805
|
+
'notebook.stickyScrollMode.indented',
|
|
806
|
+
"Nested sticky lines appear indented."
|
|
807
|
+
)),
|
|
808
|
+
],
|
|
809
|
+
default: 'indented',
|
|
810
|
+
tags: ['notebookLayout']
|
|
811
|
+
},
|
|
788
812
|
[NotebookSetting.consolidatedOutputButton]: {
|
|
789
813
|
description: ( localizeWithPath(
|
|
790
814
|
'vs/workbench/contrib/notebook/browser/notebook.contribution',
|
|
@@ -863,7 +887,18 @@ configurationRegistry.registerConfiguration({
|
|
|
863
887
|
)),
|
|
864
888
|
type: 'number',
|
|
865
889
|
default: 30,
|
|
866
|
-
tags: ['notebookLayout', 'notebookOutputLayout']
|
|
890
|
+
tags: ['notebookLayout', 'notebookOutputLayout'],
|
|
891
|
+
minimum: 1,
|
|
892
|
+
},
|
|
893
|
+
[NotebookSetting.LinkifyOutputFilePaths]: {
|
|
894
|
+
description: ( localizeWithPath(
|
|
895
|
+
'vs/workbench/contrib/notebook/browser/notebook.contribution',
|
|
896
|
+
'notebook.disableOutputFilePathLinks',
|
|
897
|
+
"Control whether to disable filepath links in the output of notebook cells."
|
|
898
|
+
)),
|
|
899
|
+
type: 'boolean',
|
|
900
|
+
default: true,
|
|
901
|
+
tags: ['notebookOutputLayout']
|
|
867
902
|
},
|
|
868
903
|
[NotebookSetting.markupFontSize]: {
|
|
869
904
|
markdownDescription: ( localizeWithPath(
|
|
@@ -1114,6 +1149,15 @@ configurationRegistry.registerConfiguration({
|
|
|
1114
1149
|
)),
|
|
1115
1150
|
type: 'boolean',
|
|
1116
1151
|
default: false
|
|
1152
|
+
},
|
|
1153
|
+
[NotebookSetting.notebookVariablesView]: {
|
|
1154
|
+
markdownDescription: ( localizeWithPath(
|
|
1155
|
+
'vs/workbench/contrib/notebook/browser/notebook.contribution',
|
|
1156
|
+
'notebook.VariablesView.description',
|
|
1157
|
+
"Enable the experimental notebook variables view within the debug panel."
|
|
1158
|
+
)),
|
|
1159
|
+
type: 'boolean',
|
|
1160
|
+
default: false
|
|
1117
1161
|
}
|
|
1118
1162
|
}
|
|
1119
1163
|
});
|
package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
2
|
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
3
|
-
import {
|
|
3
|
+
import { getDefaultNotebookCreationOptions, NotebookEditorWidget } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorWidget';
|
|
4
4
|
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
5
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
6
6
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
@@ -12,6 +12,7 @@ import { InteractiveWindowOpen } from 'vscode/vscode/vs/workbench/contrib/notebo
|
|
|
12
12
|
|
|
13
13
|
let NotebookEditorWidgetService = class NotebookEditorWidgetService {
|
|
14
14
|
constructor(editorGroupService, editorService, contextKeyService) {
|
|
15
|
+
this.editorGroupService = editorGroupService;
|
|
15
16
|
this._tokenPool = 1;
|
|
16
17
|
this._disposables = ( new DisposableStore());
|
|
17
18
|
this._notebookEditors = ( new Map());
|
|
@@ -54,7 +55,7 @@ let NotebookEditorWidgetService = class NotebookEditorWidgetService {
|
|
|
54
55
|
groupListener.set(id, listeners);
|
|
55
56
|
};
|
|
56
57
|
this._disposables.add(editorGroupService.onDidAddGroup(onNewGroup));
|
|
57
|
-
editorGroupService.
|
|
58
|
+
editorGroupService.whenReady.then(() => editorGroupService.groups.forEach(onNewGroup));
|
|
58
59
|
this._disposables.add(editorGroupService.onDidRemoveGroup(group => {
|
|
59
60
|
const listeners = groupListener.get(group.id);
|
|
60
61
|
if (listeners) {
|
|
@@ -96,6 +97,11 @@ let NotebookEditorWidgetService = class NotebookEditorWidgetService {
|
|
|
96
97
|
domNode.remove();
|
|
97
98
|
}
|
|
98
99
|
_allowWidgetMove(input, sourceID, targetID) {
|
|
100
|
+
const sourcePart = this.editorGroupService.getPart(sourceID);
|
|
101
|
+
const targetPart = this.editorGroupService.getPart(targetID);
|
|
102
|
+
if (sourcePart.windowId !== targetPart.windowId) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
99
105
|
const targetWidget = this._borrowableEditors.get(targetID)?.get(input.resource);
|
|
100
106
|
if (targetWidget) {
|
|
101
107
|
return;
|
|
@@ -130,11 +136,15 @@ let NotebookEditorWidgetService = class NotebookEditorWidgetService {
|
|
|
130
136
|
}
|
|
131
137
|
return ret;
|
|
132
138
|
}
|
|
133
|
-
retrieveWidget(accessor, group, input, creationOptions, initialDimension) {
|
|
139
|
+
retrieveWidget(accessor, group, input, creationOptions, initialDimension, codeWindow) {
|
|
134
140
|
let value = this._borrowableEditors.get(group.id)?.get(input.resource);
|
|
135
141
|
if (!value) {
|
|
136
142
|
const instantiationService = accessor.get(IInstantiationService);
|
|
137
|
-
const
|
|
143
|
+
const ctorOptions = creationOptions ?? getDefaultNotebookCreationOptions();
|
|
144
|
+
const widget = instantiationService.createInstance(NotebookEditorWidget, {
|
|
145
|
+
...ctorOptions,
|
|
146
|
+
codeWindow: codeWindow ?? ctorOptions.codeWindow,
|
|
147
|
+
}, initialDimension);
|
|
138
148
|
const token = this._tokenPool++;
|
|
139
149
|
value = { widget, token };
|
|
140
150
|
let map = this._borrowableEditors.get(group.id);
|
|
@@ -9,6 +9,7 @@ import { Lazy } from 'vscode/vscode/vs/base/common/lazy';
|
|
|
9
9
|
import { Disposable, DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
10
10
|
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
11
11
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
12
|
+
import { isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
12
13
|
import { isDefined } from 'vscode/vscode/vs/base/common/types';
|
|
13
14
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
14
15
|
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
@@ -33,6 +34,7 @@ import { RegisteredEditorPriority, IEditorResolverService } from 'vscode/vscode/
|
|
|
33
34
|
import { isProposedApiEnabled, IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
34
35
|
import { InstallRecommendedExtensionAction } from 'vscode/vscode/vs/workbench/contrib/extensions/browser/extensionsActions';
|
|
35
36
|
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
37
|
+
import { INotebookDocumentService } from 'vscode/vscode/vs/workbench/services/notebook/common/notebookDocumentService';
|
|
36
38
|
|
|
37
39
|
var NotebookProviderInfoStore_1, NotebookService_1;
|
|
38
40
|
let NotebookProviderInfoStore = class NotebookProviderInfoStore extends Disposable {
|
|
@@ -328,11 +330,15 @@ NotebookOutputRendererInfoStore = ( __decorate([
|
|
|
328
330
|
( __param(0, IStorageService))
|
|
329
331
|
], NotebookOutputRendererInfoStore));
|
|
330
332
|
class ModelData {
|
|
333
|
+
get uri() { return this.model.uri; }
|
|
331
334
|
constructor(model, onWillDispose) {
|
|
332
335
|
this.model = model;
|
|
333
336
|
this._modelEventListeners = ( new DisposableStore());
|
|
334
337
|
this._modelEventListeners.add(model.onWillDispose(() => onWillDispose(model)));
|
|
335
338
|
}
|
|
339
|
+
getCellIndex(cellUri) {
|
|
340
|
+
return this.model.cells.findIndex(cell => isEqual(cell.uri, cellUri));
|
|
341
|
+
}
|
|
336
342
|
dispose() {
|
|
337
343
|
this._modelEventListeners.dispose();
|
|
338
344
|
}
|
|
@@ -346,7 +352,7 @@ let NotebookService = class NotebookService extends Disposable {
|
|
|
346
352
|
}
|
|
347
353
|
return this._notebookProviderInfoStore;
|
|
348
354
|
}
|
|
349
|
-
constructor(_extensionService, _configurationService, _accessibilityService, _instantiationService, _codeEditorService, configurationService, _storageService) {
|
|
355
|
+
constructor(_extensionService, _configurationService, _accessibilityService, _instantiationService, _codeEditorService, configurationService, _storageService, _notebookDocumentService) {
|
|
350
356
|
super();
|
|
351
357
|
this._extensionService = _extensionService;
|
|
352
358
|
this._configurationService = _configurationService;
|
|
@@ -355,6 +361,7 @@ let NotebookService = class NotebookService extends Disposable {
|
|
|
355
361
|
this._codeEditorService = _codeEditorService;
|
|
356
362
|
this.configurationService = configurationService;
|
|
357
363
|
this._storageService = _storageService;
|
|
364
|
+
this._notebookDocumentService = _notebookDocumentService;
|
|
358
365
|
this._notebookProviders = ( new Map());
|
|
359
366
|
this._notebookProviderInfoStore = undefined;
|
|
360
367
|
this._notebookRenderersInfoStore = this._instantiationService.createInstance(NotebookOutputRendererInfoStore);
|
|
@@ -593,7 +600,9 @@ let NotebookService = class NotebookService extends Disposable {
|
|
|
593
600
|
throw new Error(`notebook for ${uri} already exists`);
|
|
594
601
|
}
|
|
595
602
|
const notebookModel = this._instantiationService.createInstance(NotebookTextModel, viewType, uri, data.cells, data.metadata, transientOptions);
|
|
596
|
-
|
|
603
|
+
const modelData = ( new ModelData(notebookModel, this._onWillDisposeDocument.bind(this)));
|
|
604
|
+
this._models.set(uri, modelData);
|
|
605
|
+
this._notebookDocumentService.addNotebookDocument(modelData);
|
|
597
606
|
this._onWillAddNotebookDocument.fire(notebookModel);
|
|
598
607
|
this._onDidAddNotebookDocument.fire(notebookModel);
|
|
599
608
|
this._postDocumentOpenActivation(viewType);
|
|
@@ -613,6 +622,7 @@ let NotebookService = class NotebookService extends Disposable {
|
|
|
613
622
|
if (modelData) {
|
|
614
623
|
this._onWillRemoveNotebookDocument.fire(modelData.model);
|
|
615
624
|
this._models.delete(model.uri);
|
|
625
|
+
this._notebookDocumentService.removeNotebookDocument(modelData);
|
|
616
626
|
modelData.dispose();
|
|
617
627
|
this._onDidRemoveNotebookDocument.fire(modelData.model);
|
|
618
628
|
}
|
|
@@ -660,7 +670,8 @@ NotebookService = NotebookService_1 = ( __decorate([
|
|
|
660
670
|
( __param(3, IInstantiationService)),
|
|
661
671
|
( __param(4, ICodeEditorService)),
|
|
662
672
|
( __param(5, IConfigurationService)),
|
|
663
|
-
( __param(6, IStorageService))
|
|
673
|
+
( __param(6, IStorageService)),
|
|
674
|
+
( __param(7, INotebookDocumentService))
|
|
664
675
|
], NotebookService));
|
|
665
676
|
|
|
666
677
|
export { NotebookOutputRendererInfoStore, NotebookProviderInfoStore, NotebookService };
|
|
@@ -503,7 +503,7 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
503
503
|
this._spliceNotebookCellOutputs(cell, { start: cell.outputs.length, deleteCount: 0, newOutputs: ( edit.outputs.map(op => ( new NotebookCellOutputTextModel(op)))) }, true, computeUndoRedo);
|
|
504
504
|
}
|
|
505
505
|
else {
|
|
506
|
-
this._spliceNotebookCellOutputs2(cell,
|
|
506
|
+
this._spliceNotebookCellOutputs2(cell, edit.outputs, computeUndoRedo);
|
|
507
507
|
}
|
|
508
508
|
break;
|
|
509
509
|
}
|
|
@@ -889,14 +889,16 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
889
889
|
return;
|
|
890
890
|
}
|
|
891
891
|
if (outputs.length <= 1) {
|
|
892
|
-
this._spliceNotebookCellOutputs(cell, { start: 0, deleteCount: cell.outputs.length, newOutputs: outputs }, false, computeUndoRedo);
|
|
892
|
+
this._spliceNotebookCellOutputs(cell, { start: 0, deleteCount: cell.outputs.length, newOutputs: ( outputs.map(op => ( new NotebookCellOutputTextModel(op)))) }, false, computeUndoRedo);
|
|
893
893
|
return;
|
|
894
894
|
}
|
|
895
895
|
const diff = ( new LcsDiff(( new OutputSequence(cell.outputs)), ( new OutputSequence(outputs))));
|
|
896
896
|
const diffResult = diff.ComputeDiff(false);
|
|
897
|
-
const splices = ( diffResult.changes.map(
|
|
898
|
-
|
|
899
|
-
|
|
897
|
+
const splices = ( diffResult.changes.map(change => ({
|
|
898
|
+
start: change.originalStart,
|
|
899
|
+
deleteCount: change.originalLength,
|
|
900
|
+
newOutputs: ( outputs.slice(change.modifiedStart, change.modifiedStart + change.modifiedLength).map(op => ( new NotebookCellOutputTextModel(op))))
|
|
901
|
+
})));
|
|
900
902
|
splices.reverse().forEach(splice => {
|
|
901
903
|
this._spliceNotebookCellOutputs(cell, splice, false, computeUndoRedo);
|
|
902
904
|
});
|
package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js
CHANGED
|
@@ -44,7 +44,7 @@ let NotebookModelReferenceCollection = class NotebookModelReferenceCollection ex
|
|
|
44
44
|
isDirty(resource) {
|
|
45
45
|
return this._dirtyStates.get(resource) ?? false;
|
|
46
46
|
}
|
|
47
|
-
async createReferencedObject(key, viewType, hasAssociatedFilePath) {
|
|
47
|
+
async createReferencedObject(key, viewType, hasAssociatedFilePath, limits) {
|
|
48
48
|
this.modelsToDispose.delete(key);
|
|
49
49
|
const uri = ( URI.parse(key));
|
|
50
50
|
const workingCopyTypeId = NotebookWorkingCopyTypeIdentifier.create(viewType);
|
|
@@ -55,7 +55,7 @@ let NotebookModelReferenceCollection = class NotebookModelReferenceCollection ex
|
|
|
55
55
|
this._workingCopyManagers.set(workingCopyTypeId, workingCopyManager);
|
|
56
56
|
}
|
|
57
57
|
const model = this._instantiationService.createInstance(SimpleNotebookEditorModel, uri, hasAssociatedFilePath, viewType, workingCopyManager);
|
|
58
|
-
const result = await model.load();
|
|
58
|
+
const result = await model.load({ limits });
|
|
59
59
|
let onDirtyAutoReference;
|
|
60
60
|
this._modelListener.set(result, combinedDisposable(result.onDidSave(() => this._onDidSaveNotebook.fire(result.resource)), result.onDidChangeDirty(() => {
|
|
61
61
|
const isDirty = result.isDirty();
|
|
@@ -121,7 +121,7 @@ let NotebookModelResolverServiceImpl = class NotebookModelResolverServiceImpl {
|
|
|
121
121
|
isDirty(resource) {
|
|
122
122
|
return this._data.isDirty(resource);
|
|
123
123
|
}
|
|
124
|
-
async resolve(arg0, viewType) {
|
|
124
|
+
async resolve(arg0, viewType, limits) {
|
|
125
125
|
let resource;
|
|
126
126
|
let hasAssociatedFilePath = false;
|
|
127
127
|
if (URI.isUri(arg0)) {
|
|
@@ -178,7 +178,7 @@ let NotebookModelResolverServiceImpl = class NotebookModelResolverServiceImpl {
|
|
|
178
178
|
throw new Error(`A notebook with view type '${existingViewType2}' already exists for '${resource}', CANNOT create another notebook with view type ${viewType}`);
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
|
-
const reference = this._data.acquire(( resource.toString()), viewType, hasAssociatedFilePath);
|
|
181
|
+
const reference = this._data.acquire(( resource.toString()), viewType, hasAssociatedFilePath, limits);
|
|
182
182
|
try {
|
|
183
183
|
const model = await reference.object;
|
|
184
184
|
return {
|
package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js
CHANGED
|
@@ -6,6 +6,7 @@ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
|
6
6
|
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
7
7
|
import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
|
|
8
8
|
import { contentMatchesToTextSearchMatches, webviewMatchesToTextSearchMatches } from 'vscode/vscode/vs/workbench/contrib/search/browser/notebookSearch/searchNotebookHelpers';
|
|
9
|
+
import { pathIncludedInQuery } from 'vscode/vscode/vs/workbench/services/search/common/search';
|
|
9
10
|
import { coalesce } from 'vscode/vscode/vs/base/common/arrays';
|
|
10
11
|
import { isNumber } from 'vscode/vscode/vs/base/common/types';
|
|
11
12
|
import { IEditorResolverService } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
|
|
@@ -102,12 +103,16 @@ let NotebookSearchService = class NotebookSearchService {
|
|
|
102
103
|
const promises = [];
|
|
103
104
|
contributedNotebookTypes.forEach((notebook) => {
|
|
104
105
|
promises.push((async () => {
|
|
106
|
+
const canResolve = await this.notebookService.canResolve(notebook.id);
|
|
107
|
+
if (!canResolve) {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
105
110
|
const serializer = (await this.notebookService.withNotebookDataProvider(notebook.id)).serializer;
|
|
106
111
|
return await serializer.searchInNotebooks(textQuery, token, allPriorityInfo);
|
|
107
112
|
})());
|
|
108
113
|
});
|
|
109
114
|
const start = Date.now();
|
|
110
|
-
const searchComplete = (await Promise.all(promises));
|
|
115
|
+
const searchComplete = coalesce(await Promise.all(promises));
|
|
111
116
|
const results = searchComplete.flatMap(e => e.results);
|
|
112
117
|
let limitHit = ( searchComplete.some(e => e.limitHit));
|
|
113
118
|
const uniqueResults = ( new ResourceMap(uri => this.uriIdentityService.extUri.getComparisonKey(uri)));
|
|
@@ -138,6 +143,10 @@ let NotebookSearchService = class NotebookSearchService {
|
|
|
138
143
|
continue;
|
|
139
144
|
}
|
|
140
145
|
const askMax = isNumber(query.maxResults) ? query.maxResults + 1 : Number.MAX_SAFE_INTEGER;
|
|
146
|
+
const uri = widget.viewModel.uri;
|
|
147
|
+
if (!pathIncludedInQuery(query, uri.fsPath)) {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
141
150
|
let matches = await widget
|
|
142
151
|
.find(query.contentPattern.pattern, {
|
|
143
152
|
regex: query.contentPattern.isRegExp,
|
|
@@ -148,7 +157,6 @@ let NotebookSearchService = class NotebookSearchService {
|
|
|
148
157
|
includeCodeInput: query.contentPattern.notebookInfo?.isInNotebookCellInput ?? true,
|
|
149
158
|
includeOutput: query.contentPattern.notebookInfo?.isInNotebookCellOutput ?? true,
|
|
150
159
|
}, token, false, true, searchID);
|
|
151
|
-
const uri = widget.viewModel.uri;
|
|
152
160
|
if (matches.length) {
|
|
153
161
|
if (askMax && matches.length >= askMax) {
|
|
154
162
|
limitHit = true;
|
|
@@ -126,9 +126,9 @@ let StoredFileWorkingCopyManager = class StoredFileWorkingCopyManager extends Ba
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
queueWorkingCopyReload(workingCopy) {
|
|
129
|
-
const
|
|
130
|
-
if (
|
|
131
|
-
|
|
129
|
+
const queueSize = this.workingCopyResolveQueue.queueSize(workingCopy.resource);
|
|
130
|
+
if (queueSize <= 1) {
|
|
131
|
+
this.workingCopyResolveQueue.queueFor(workingCopy.resource, async () => {
|
|
132
132
|
try {
|
|
133
133
|
await this.reload(workingCopy);
|
|
134
134
|
}
|
|
@@ -245,7 +245,8 @@ let StoredFileWorkingCopyManager = class StoredFileWorkingCopyManager extends Ba
|
|
|
245
245
|
let didCreateWorkingCopy = false;
|
|
246
246
|
const resolveOptions = {
|
|
247
247
|
contents: options?.contents,
|
|
248
|
-
forceReadFromFile: options?.reload?.force
|
|
248
|
+
forceReadFromFile: options?.reload?.force,
|
|
249
|
+
limits: options?.limits
|
|
249
250
|
};
|
|
250
251
|
if (workingCopy) {
|
|
251
252
|
if (options?.contents) {
|