@codingame/monaco-vscode-debug-service-override 2.2.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/assets/continue-tb.png +0 -0
  2. package/assets/pause-tb.png +0 -0
  3. package/assets/restart-tb.png +0 -0
  4. package/assets/run-with-debugging-tb.png +0 -0
  5. package/assets/stepinto-tb.png +0 -0
  6. package/assets/stepout-tb.png +0 -0
  7. package/assets/stepover-tb.png +0 -0
  8. package/assets/stop-tb.png +0 -0
  9. package/debug.js +1 -0
  10. package/package.json +2 -2
  11. package/tools/debugAssets.js +4 -0
  12. package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +2 -2
  13. package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +180 -4
  14. package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +8 -8
  15. package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +112 -50
  16. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +7 -10
  17. package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +14 -7
  18. package/vscode/src/vs/workbench/contrib/debug/browser/debugProgress.js +2 -4
  19. package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +8 -8
  20. package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +5 -6
  21. package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +14 -10
  22. package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +19 -7
  23. package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +18 -8
  24. package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +1 -1
  25. package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +33 -4
  26. package/vscode/src/vs/workbench/contrib/debug/browser/media/all.png.js +12 -0
  27. package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +4 -4
  28. package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +130 -18
  29. package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +28 -20
  30. package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +3 -2
  31. package/vscode/src/vs/workbench/contrib/debug/common/debugSchemas.js +48 -4
  32. package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +11 -24
  33. package/vscode/src/vs/workbench/contrib/debug/common/debugViewModel.js +29 -0
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands.js +64 -0
@@ -1,27 +1,27 @@
1
1
  import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { ElementsDragAndDropData } from 'vscode/vscode/vs/base/browser/ui/list/listView';
2
3
  import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
3
- import { CONTEXT_CAN_VIEW_MEMORY, CONTEXT_WATCH_ITEM_TYPE, WATCH_VIEW_ID, CONTEXT_WATCH_EXPRESSIONS_EXIST, IDebugService, CONTEXT_VARIABLE_IS_READONLY, CONTEXT_WATCH_EXPRESSIONS_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
4
- import { Variable, Expression } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugModel';
4
+ import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
5
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
6
+ import { createAndFillInContextMenuActions } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
7
+ import { MenuId, registerAction2, Action2, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
8
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
9
+ import { ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
5
10
  import { IContextMenuService, IContextViewService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
6
11
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
7
12
  import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
8
- import { AbstractExpressionsRenderer, renderExpressionValue, renderViewTree } from 'vscode/vscode/vs/workbench/contrib/debug/browser/baseDebugView';
9
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
10
- import { ViewAction, ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
11
13
  import { WorkbenchAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
12
- import { ElementsDragAndDropData } from 'vscode/vscode/vs/base/browser/ui/list/listView';
13
- import { VariablesRenderer } from './variablesView.js';
14
- import { ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
15
- import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
16
14
  import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
17
- import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
18
15
  import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
16
+ import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
17
+ import { ViewAction, ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
18
+ import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
19
+ import { AbstractExpressionsRenderer, renderExpressionValue, renderViewTree, AbstractExpressionDataSource } from 'vscode/vscode/vs/workbench/contrib/debug/browser/baseDebugView';
19
20
  import { watchExpressionsAdd, watchExpressionsRemoveAll } from 'vscode/vscode/vs/workbench/contrib/debug/browser/debugIcons';
20
- import { MenuId, registerAction2, Action2, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
21
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
22
- import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
23
- import { createAndFillInContextMenuActions } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
24
21
  import { LinkDetector } from './linkDetector.js';
22
+ import { VariablesRenderer, VisualizedVariableRenderer } from './variablesView.js';
23
+ import { CONTEXT_CAN_VIEW_MEMORY, CONTEXT_WATCH_ITEM_TYPE, WATCH_VIEW_ID, CONTEXT_WATCH_EXPRESSIONS_EXIST, IDebugService, CONTEXT_VARIABLE_IS_READONLY, CONTEXT_WATCH_EXPRESSIONS_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
24
+ import { Variable, Expression, VisualizedExpression } from 'vscode/vscode/vs/workbench/contrib/debug/common/debugModel';
25
25
 
26
26
  var WatchExpressionsRenderer_1;
27
27
  const MAX_VALUE_RENDER_LENGTH_IN_VIEWLET = 1024;
@@ -49,8 +49,12 @@ let WatchExpressionsView = class WatchExpressionsView extends ViewPane {
49
49
  container.classList.add('debug-watch');
50
50
  const treeContainer = renderViewTree(container);
51
51
  const expressionsRenderer = this.instantiationService.createInstance(WatchExpressionsRenderer);
52
- const linkeDetector = this.instantiationService.createInstance(LinkDetector);
53
- this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'WatchExpressions', treeContainer, ( new WatchExpressionsDelegate()), [expressionsRenderer, this.instantiationService.createInstance(VariablesRenderer, linkeDetector)], ( new WatchExpressionsDataSource()), {
52
+ const linkDetector = this.instantiationService.createInstance(LinkDetector);
53
+ this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'WatchExpressions', treeContainer, ( new WatchExpressionsDelegate()), [
54
+ expressionsRenderer,
55
+ this.instantiationService.createInstance(VariablesRenderer, linkDetector),
56
+ this.instantiationService.createInstance(VisualizedVariableRenderer, linkDetector),
57
+ ], this.instantiationService.createInstance(WatchExpressionsDataSource), {
54
58
  accessibilityProvider: ( new WatchExpressionsAccessibilityProvider()),
55
59
  identityProvider: { getId: (element) => element.getId() },
56
60
  keyboardNavigationLabelProvider: {
@@ -68,6 +72,7 @@ let WatchExpressionsView = class WatchExpressionsView extends ViewPane {
68
72
  });
69
73
  this.tree.setInput(this.debugService);
70
74
  CONTEXT_WATCH_EXPRESSIONS_FOCUSED.bindTo(this.tree.contextKeyService);
75
+ this._register(VisualizedVariableRenderer.rendererOnVisualizationRange(this.debugService.getViewModel(), this.tree));
71
76
  this._register(this.tree.onContextMenu(e => this.onContextMenu(e)));
72
77
  this._register(this.tree.onMouseDblClick(e => this.onMouseDblClick(e)));
73
78
  this._register(this.debugService.getModel().onDidChangeWatchExpressions(async (we) => {
@@ -108,7 +113,7 @@ let WatchExpressionsView = class WatchExpressionsView extends ViewPane {
108
113
  let horizontalScrolling;
109
114
  this._register(this.debugService.getViewModel().onDidSelectExpression(e => {
110
115
  const expression = e?.expression;
111
- if (expression instanceof Expression || (expression instanceof Variable && e?.settingWatch)) {
116
+ if (expression && this.tree.hasElement(expression)) {
112
117
  horizontalScrolling = this.tree.options.horizontalScrolling;
113
118
  if (horizontalScrolling) {
114
119
  this.tree.updateOptions({ horizontalScrolling: false });
@@ -146,7 +151,7 @@ let WatchExpressionsView = class WatchExpressionsView extends ViewPane {
146
151
  }
147
152
  const element = e.element;
148
153
  const selectedExpression = this.debugService.getViewModel().getSelectedExpression();
149
- if (element instanceof Expression && element !== selectedExpression?.expression) {
154
+ if ((element instanceof Expression && element !== selectedExpression?.expression) || (element instanceof VisualizedExpression && element.treeItem.canEdit)) {
150
155
  this.debugService.getViewModel().setSelectedExpression(element, false);
151
156
  }
152
157
  else if (!element) {
@@ -189,17 +194,20 @@ class WatchExpressionsDelegate {
189
194
  if (element instanceof Expression) {
190
195
  return WatchExpressionsRenderer.ID;
191
196
  }
197
+ if (element instanceof VisualizedExpression) {
198
+ return VisualizedVariableRenderer.ID;
199
+ }
192
200
  return VariablesRenderer.ID;
193
201
  }
194
202
  }
195
203
  function isDebugService(element) {
196
204
  return typeof element.getConfigurationManager === 'function';
197
205
  }
198
- class WatchExpressionsDataSource {
206
+ class WatchExpressionsDataSource extends AbstractExpressionDataSource {
199
207
  hasChildren(element) {
200
208
  return isDebugService(element) || element.hasChildren;
201
209
  }
202
- getChildren(element) {
210
+ doGetChildren(element) {
203
211
  if (isDebugService(element)) {
204
212
  const debugService = element;
205
213
  const watchExpressions = debugService.getModel().getWatchExpressions();
@@ -141,8 +141,9 @@ viewsRegistry.registerViewWelcomeContent(WelcomeView.ID, {
141
141
  content: ( localizeWithPath('vs/workbench/contrib/debug/browser/welcomeView', {
142
142
  key: 'customizeRunAndDebugOpenFolder',
143
143
  comment: [
144
- 'Please do not translate the word "commmand", it is part of our internal syntax which must not change',
145
- '{Locked="](command:{0})"}'
144
+ 'Please do not translate the word "command", it is part of our internal syntax which must not change',
145
+ 'Please do not translate "launch.json", it is the specific configuration file name',
146
+ '{Locked="](command:{0})"}',
146
147
  ]
147
148
  }, "To customize Run and Debug, [open a folder](command:{0}) and create a launch.json file.", (isMacintosh && !isWeb) ? OpenFileFolderAction.ID : OpenFolderAction.ID)),
148
149
  when: ( ContextKeyExpr.and(CONTEXT_DEBUGGERS_AVAILABLE, ( WorkbenchStateContext.isEqualTo('empty')))),
@@ -2,8 +2,12 @@ import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensio
2
2
  import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
3
  import { launchSchemaId } from 'vscode/vscode/vs/workbench/services/configuration/common/configuration';
4
4
  import { inputsSchema } from 'vscode/vscode/vs/workbench/services/configurationResolver/common/configurationResolverSchema';
5
+ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
6
+ import { Extensions } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionFeatures';
7
+ import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
8
+ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
5
9
 
6
- const debuggersExtPoint = ( ExtensionsRegistry.registerExtensionPoint({
10
+ const debuggersExtPoint = ExtensionsRegistry.registerExtensionPoint({
7
11
  extensionPoint: 'debuggers',
8
12
  defaultExtensionKind: ['workspace'],
9
13
  jsonSchema: {
@@ -209,8 +213,8 @@ const debuggersExtPoint = ( ExtensionsRegistry.registerExtensionPoint({
209
213
  }
210
214
  }
211
215
  }
212
- }));
213
- const breakpointsExtPoint = ( ExtensionsRegistry.registerExtensionPoint({
216
+ });
217
+ const breakpointsExtPoint = ExtensionsRegistry.registerExtensionPoint({
214
218
  extensionPoint: 'breakpoints',
215
219
  jsonSchema: {
216
220
  description: ( localizeWithPath(
@@ -245,7 +249,7 @@ const breakpointsExtPoint = ( ExtensionsRegistry.registerExtensionPoint({
245
249
  }
246
250
  }
247
251
  }
248
- }));
252
+ });
249
253
  const presentationSchema = {
250
254
  type: 'object',
251
255
  description: ( localizeWithPath(
@@ -412,5 +416,45 @@ const launchSchema = {
412
416
  inputs: inputsSchema.definitions.inputs
413
417
  }
414
418
  };
419
+ class DebuggersDataRenderer extends Disposable {
420
+ constructor() {
421
+ super(...arguments);
422
+ this.type = 'table';
423
+ }
424
+ shouldRender(manifest) {
425
+ return !!manifest.contributes?.debuggers;
426
+ }
427
+ render(manifest) {
428
+ const contrib = manifest.contributes?.debuggers || [];
429
+ if (!contrib.length) {
430
+ return { data: { headers: [], rows: [] }, dispose: () => { } };
431
+ }
432
+ const headers = [
433
+ ( localizeWithPath('vs/workbench/contrib/debug/common/debugSchemas', 'debugger name', "Name")),
434
+ ( localizeWithPath('vs/workbench/contrib/debug/common/debugSchemas', 'debugger type', "Type")),
435
+ ];
436
+ const rows = ( contrib.map(d => {
437
+ return [
438
+ d.label ?? '',
439
+ d.type
440
+ ];
441
+ }));
442
+ return {
443
+ data: {
444
+ headers,
445
+ rows
446
+ },
447
+ dispose: () => { }
448
+ };
449
+ }
450
+ }
451
+ ( Registry.as(Extensions.ExtensionFeaturesRegistry)).registerExtensionFeature({
452
+ id: 'debuggers',
453
+ label: ( localizeWithPath('vs/workbench/contrib/debug/common/debugSchemas', 'debuggers', "Debuggers")),
454
+ access: {
455
+ canToggle: false
456
+ },
457
+ renderer: ( new SyncDescriptor(DebuggersDataRenderer)),
458
+ });
415
459
 
416
460
  export { breakpointsExtPoint, debuggersExtPoint, launchSchema, presentationSchema };
@@ -54,7 +54,14 @@ let DebugStorage = class DebugStorage extends Disposable {
54
54
  let result;
55
55
  try {
56
56
  result = ( JSON.parse(this.storageService.get(DEBUG_BREAKPOINTS_KEY, 1 , '[]')).map((breakpoint) => {
57
- return ( new Breakpoint(( URI.parse(breakpoint.uri.external || breakpoint.source.uri.external)), breakpoint.lineNumber, breakpoint.column, breakpoint.enabled, breakpoint.condition, breakpoint.hitCondition, breakpoint.logMessage, breakpoint.adapterData, this.textFileService, this.uriIdentityService, this.logService, breakpoint.id, breakpoint.triggeredBy));
57
+ breakpoint.uri = URI.revive(breakpoint.uri);
58
+ return ( new Breakpoint(
59
+ breakpoint,
60
+ this.textFileService,
61
+ this.uriIdentityService,
62
+ this.logService,
63
+ breakpoint.id
64
+ ));
58
65
  }));
59
66
  }
60
67
  catch (e) { }
@@ -64,7 +71,7 @@ let DebugStorage = class DebugStorage extends Disposable {
64
71
  let result;
65
72
  try {
66
73
  result = ( JSON.parse(this.storageService.get(DEBUG_FUNCTION_BREAKPOINTS_KEY, 1 , '[]')).map((fb) => {
67
- return ( new FunctionBreakpoint(fb.name, fb.enabled, fb.hitCondition, fb.condition, fb.logMessage, fb.id));
74
+ return ( new FunctionBreakpoint(fb, fb.id));
68
75
  }));
69
76
  }
70
77
  catch (e) { }
@@ -74,16 +81,7 @@ let DebugStorage = class DebugStorage extends Disposable {
74
81
  let result;
75
82
  try {
76
83
  result = ( JSON.parse(this.storageService.get(DEBUG_EXCEPTION_BREAKPOINTS_KEY, 1 , '[]')).map((exBreakpoint) => {
77
- return ( new ExceptionBreakpoint(
78
- exBreakpoint.filter,
79
- exBreakpoint.label,
80
- exBreakpoint.enabled,
81
- exBreakpoint.supportsCondition,
82
- exBreakpoint.condition,
83
- exBreakpoint.description,
84
- exBreakpoint.conditionDescription,
85
- !!exBreakpoint.fallback
86
- ));
84
+ return ( new ExceptionBreakpoint(exBreakpoint, exBreakpoint.id));
87
85
  }));
88
86
  }
89
87
  catch (e) { }
@@ -93,18 +91,7 @@ let DebugStorage = class DebugStorage extends Disposable {
93
91
  let result;
94
92
  try {
95
93
  result = ( JSON.parse(this.storageService.get(DEBUG_DATA_BREAKPOINTS_KEY, 1 , '[]')).map((dbp) => {
96
- return ( new DataBreakpoint(
97
- dbp.description,
98
- dbp.dataId,
99
- true,
100
- dbp.enabled,
101
- dbp.hitCondition,
102
- dbp.condition,
103
- dbp.logMessage,
104
- dbp.accessTypes,
105
- dbp.accessType,
106
- dbp.id
107
- ));
94
+ return ( new DataBreakpoint(dbp, dbp.id));
108
95
  }));
109
96
  }
110
97
  catch (e) { }
@@ -12,6 +12,9 @@ class ViewModel {
12
12
  this._onDidSelectExpression = ( new Emitter());
13
13
  this._onDidEvaluateLazyExpression = ( new Emitter());
14
14
  this._onWillUpdateViews = ( new Emitter());
15
+ this._onDidChangeVisualization = ( new Emitter());
16
+ this.visualized = ( new WeakMap());
17
+ this.preferredVisualizers = ( new Map());
15
18
  contextKeyService.bufferChangeEvents(() => {
16
19
  this.expressionSelectedContextKey = CONTEXT_EXPRESSION_SELECTED.bindTo(contextKeyService);
17
20
  this.loadedScriptsSupportedContextKey = CONTEXT_LOADED_SCRIPTS_SUPPORTED.bindTo(contextKeyService);
@@ -84,6 +87,9 @@ class ViewModel {
84
87
  get onDidFocusStackFrame() {
85
88
  return this._onDidFocusStackFrame.event;
86
89
  }
90
+ get onDidChangeVisualization() {
91
+ return this._onDidChangeVisualization.event;
92
+ }
87
93
  getSelectedExpression() {
88
94
  return this.selectedExpression;
89
95
  }
@@ -110,10 +116,33 @@ class ViewModel {
110
116
  setMultiSessionView(isMultiSessionView) {
111
117
  this.multiSessionDebug.set(isMultiSessionView);
112
118
  }
119
+ setVisualizedExpression(original, visualized) {
120
+ const current = this.visualized.get(original) || original;
121
+ const key = this.getPreferredVisualizedKey(original);
122
+ if (visualized) {
123
+ this.visualized.set(original, visualized);
124
+ this.preferredVisualizers.set(key, visualized.treeId);
125
+ }
126
+ else {
127
+ this.visualized.delete(original);
128
+ this.preferredVisualizers.delete(key);
129
+ }
130
+ this._onDidChangeVisualization.fire({ original: current, replacement: visualized || original });
131
+ }
132
+ getVisualizedExpression(expression) {
133
+ return this.visualized.get(expression) || this.preferredVisualizers.get(this.getPreferredVisualizedKey(expression));
134
+ }
113
135
  async evaluateLazyExpression(expression) {
114
136
  await expression.evaluateLazy();
115
137
  this._onDidEvaluateLazyExpression.fire(expression);
116
138
  }
139
+ getPreferredVisualizedKey(expr) {
140
+ return JSON.stringify([
141
+ expr.name,
142
+ expr.type,
143
+ !!expr.memoryReference,
144
+ ].join('\0'));
145
+ }
117
146
  }
118
147
 
119
148
  export { ViewModel };
@@ -0,0 +1,64 @@
1
+ import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
2
+ import { URI } from 'vscode/vscode/vs/base/common/uri';
3
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
4
+ import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
5
+ import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService';
6
+ import { INotebookKernelService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService';
7
+ import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
8
+
9
+ const COPY_NOTEBOOK_VARIABLE_VALUE_ID = 'workbench.debug.viewlet.action.copyWorkspaceVariableValue';
10
+ const COPY_NOTEBOOK_VARIABLE_VALUE_LABEL = ( localizeWithPath(
11
+ 'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands',
12
+ 'copyWorkspaceVariableValue',
13
+ "Copy Value"
14
+ ));
15
+ registerAction2(class extends Action2 {
16
+ constructor() {
17
+ super({
18
+ id: COPY_NOTEBOOK_VARIABLE_VALUE_ID,
19
+ title: COPY_NOTEBOOK_VARIABLE_VALUE_LABEL,
20
+ f1: false,
21
+ });
22
+ }
23
+ run(accessor, context) {
24
+ const clipboardService = accessor.get(IClipboardService);
25
+ if (context.value) {
26
+ clipboardService.writeText(context.value);
27
+ }
28
+ }
29
+ });
30
+ registerAction2(class extends Action2 {
31
+ constructor() {
32
+ super({
33
+ id: '_executeNotebookVariableProvider',
34
+ title: ( localizeWithPath(
35
+ 'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands',
36
+ 'executeNotebookVariableProvider',
37
+ "Execute Notebook Variable Provider"
38
+ )),
39
+ f1: false,
40
+ });
41
+ }
42
+ async run(accessor, resource) {
43
+ if (!resource) {
44
+ return [];
45
+ }
46
+ const uri = URI.revive(resource);
47
+ const notebookKernelService = accessor.get(INotebookKernelService);
48
+ const notebookService = accessor.get(INotebookService);
49
+ const notebookTextModel = notebookService.getNotebookTextModel(uri);
50
+ if (!notebookTextModel) {
51
+ return [];
52
+ }
53
+ const selectedKernel = notebookKernelService.getMatchingKernel(notebookTextModel).selected;
54
+ if (selectedKernel && selectedKernel.hasVariableProvider) {
55
+ const variables = selectedKernel.provideVariables(notebookTextModel.uri, undefined, 'named', 0, CancellationToken.None);
56
+ return await ( variables
57
+ .map(variable => { return variable; }))
58
+ .toPromise();
59
+ }
60
+ return [];
61
+ }
62
+ });
63
+
64
+ export { COPY_NOTEBOOK_VARIABLE_VALUE_ID, COPY_NOTEBOOK_VARIABLE_VALUE_LABEL };