@theia/debug 1.24.0-next.6 → 1.24.0-next.62

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 (71) hide show
  1. package/lib/browser/console/debug-console-items.d.ts +1 -1
  2. package/lib/browser/console/debug-console-items.d.ts.map +1 -1
  3. package/lib/browser/console/debug-console-items.js +1 -0
  4. package/lib/browser/console/debug-console-items.js.map +1 -1
  5. package/lib/browser/console/debug-console-session.d.ts +1 -2
  6. package/lib/browser/console/debug-console-session.d.ts.map +1 -1
  7. package/lib/browser/console/debug-console-session.js +1 -0
  8. package/lib/browser/console/debug-console-session.js.map +1 -1
  9. package/lib/browser/debug-configuration-manager.d.ts +4 -2
  10. package/lib/browser/debug-configuration-manager.d.ts.map +1 -1
  11. package/lib/browser/debug-configuration-manager.js +36 -6
  12. package/lib/browser/debug-configuration-manager.js.map +1 -1
  13. package/lib/browser/debug-frontend-application-contribution.d.ts +1 -1
  14. package/lib/browser/debug-frontend-application-contribution.d.ts.map +1 -1
  15. package/lib/browser/debug-frontend-application-contribution.js +1 -0
  16. package/lib/browser/debug-frontend-application-contribution.js.map +1 -1
  17. package/lib/browser/debug-frontend-module.js +1 -1
  18. package/lib/browser/debug-frontend-module.js.map +1 -1
  19. package/lib/browser/debug-prefix-configuration.d.ts.map +1 -1
  20. package/lib/browser/debug-prefix-configuration.js.map +1 -1
  21. package/lib/browser/debug-session-manager.d.ts +1 -1
  22. package/lib/browser/debug-session-manager.d.ts.map +1 -1
  23. package/lib/browser/debug-session-manager.js.map +1 -1
  24. package/lib/browser/editor/debug-breakpoint-widget.d.ts +1 -1
  25. package/lib/browser/editor/debug-breakpoint-widget.d.ts.map +1 -1
  26. package/lib/browser/editor/debug-breakpoint-widget.js +8 -5
  27. package/lib/browser/editor/debug-breakpoint-widget.js.map +1 -1
  28. package/lib/browser/editor/debug-editor-model.d.ts +5 -4
  29. package/lib/browser/editor/debug-editor-model.d.ts.map +1 -1
  30. package/lib/browser/editor/debug-editor-model.js +5 -3
  31. package/lib/browser/editor/debug-editor-model.js.map +1 -1
  32. package/lib/browser/editor/debug-editor-service.d.ts +1 -1
  33. package/lib/browser/editor/debug-editor-service.d.ts.map +1 -1
  34. package/lib/browser/editor/debug-editor-service.js +1 -0
  35. package/lib/browser/editor/debug-editor-service.js.map +1 -1
  36. package/lib/browser/editor/debug-exception-widget.d.ts.map +1 -1
  37. package/lib/browser/editor/debug-exception-widget.js +1 -0
  38. package/lib/browser/editor/debug-exception-widget.js.map +1 -1
  39. package/lib/browser/editor/debug-expression-provider.d.ts +1 -1
  40. package/lib/browser/editor/debug-expression-provider.d.ts.map +1 -1
  41. package/lib/browser/editor/debug-expression-provider.js.map +1 -1
  42. package/lib/browser/editor/debug-hover-widget.d.ts +1 -1
  43. package/lib/browser/editor/debug-hover-widget.d.ts.map +1 -1
  44. package/lib/browser/editor/debug-hover-widget.js +1 -0
  45. package/lib/browser/editor/debug-hover-widget.js.map +1 -1
  46. package/lib/browser/editor/debug-inline-value-decorator.d.ts +4 -4
  47. package/lib/browser/editor/debug-inline-value-decorator.d.ts.map +1 -1
  48. package/lib/browser/editor/debug-inline-value-decorator.js +7 -7
  49. package/lib/browser/editor/debug-inline-value-decorator.js.map +1 -1
  50. package/lib/browser/model/debug-stack-frame.d.ts +1 -1
  51. package/lib/browser/model/debug-stack-frame.d.ts.map +1 -1
  52. package/lib/browser/model/debug-stack-frame.js +1 -0
  53. package/lib/browser/model/debug-stack-frame.js.map +1 -1
  54. package/package.json +16 -15
  55. package/src/browser/console/debug-console-items.tsx +1 -0
  56. package/src/browser/console/debug-console-session.ts +4 -1
  57. package/src/browser/debug-configuration-manager.ts +39 -7
  58. package/src/browser/debug-frontend-application-contribution.ts +1 -0
  59. package/src/browser/debug-frontend-module.ts +1 -1
  60. package/src/browser/debug-prefix-configuration.ts +2 -2
  61. package/src/browser/debug-session-manager.ts +1 -0
  62. package/src/browser/editor/debug-breakpoint-widget.tsx +40 -30
  63. package/src/browser/editor/debug-editor-model.ts +10 -6
  64. package/src/browser/editor/debug-editor-service.ts +1 -0
  65. package/src/browser/editor/debug-exception-widget.tsx +1 -0
  66. package/src/browser/editor/debug-expression-provider.ts +1 -0
  67. package/src/browser/editor/debug-hover-widget.ts +1 -0
  68. package/src/browser/editor/debug-inline-value-decorator.ts +14 -18
  69. package/src/browser/model/debug-stack-frame.tsx +1 -0
  70. package/src/browser/style/index.css +2 -7
  71. package/src/browser/monaco.d.ts +0 -18
@@ -26,7 +26,7 @@ import URI from '@theia/core/lib/common/uri';
26
26
  import { Emitter, Event, WaitUntilEvent } from '@theia/core/lib/common/event';
27
27
  import { EditorManager, EditorWidget } from '@theia/editor/lib/browser';
28
28
  import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor';
29
- import { PreferenceScope, PreferenceService, QuickPickValue, StorageService } from '@theia/core/lib/browser';
29
+ import { LabelProvider, PreferenceScope, PreferenceService, QuickPickValue, StorageService } from '@theia/core/lib/browser';
30
30
  import { QuickPickService } from '@theia/core/lib/common/quick-pick-service';
31
31
  import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
32
32
  import { DebugConfigurationModel } from './debug-configuration-model';
@@ -37,6 +37,10 @@ import { DebugConfiguration } from '../common/debug-common';
37
37
  import { WorkspaceVariableContribution } from '@theia/workspace/lib/browser/workspace-variable-contribution';
38
38
  import { PreferenceConfigurations } from '@theia/core/lib/browser/preferences/preference-configurations';
39
39
  import { MonacoTextModelService } from '@theia/monaco/lib/browser/monaco-text-model-service';
40
+ import * as monaco from '@theia/monaco-editor-core';
41
+ import { ICommandService } from '@theia/monaco-editor-core/esm/vs/platform/commands/common/commands';
42
+ import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
43
+ import { nls } from '@theia/core';
40
44
 
41
45
  export interface WillProvideDebugConfiguration extends WaitUntilEvent {
42
46
  }
@@ -56,6 +60,9 @@ export class DebugConfigurationManager {
56
60
  @inject(ContextKeyService)
57
61
  protected readonly contextKeyService: ContextKeyService;
58
62
 
63
+ @inject(LabelProvider)
64
+ protected readonly labelProvider: LabelProvider;
65
+
59
66
  @inject(MonacoTextModelService)
60
67
  protected readonly textModelService: MonacoTextModelService;
61
68
 
@@ -160,7 +167,7 @@ export class DebugConfigurationManager {
160
167
  this._currentOptions = options && !options.configuration.dynamic ? this.find(options.configuration.name, options.workspaceFolderUri) : options;
161
168
 
162
169
  if (!this._currentOptions) {
163
- const { model } = this;
170
+ const model = this.getModel();
164
171
  if (model) {
165
172
  const configuration = model.configurations[0];
166
173
  if (configuration) {
@@ -191,14 +198,23 @@ export class DebugConfigurationManager {
191
198
  }
192
199
 
193
200
  async openConfiguration(): Promise<void> {
194
- const { model } = this;
201
+ const model = this.getModel();
195
202
  if (model) {
196
203
  await this.doOpen(model);
197
204
  }
198
205
  }
199
206
 
200
207
  async addConfiguration(): Promise<void> {
201
- const { model } = this;
208
+ let rootUri: URI | undefined = undefined;
209
+ if (this.workspaceService.saved && this.workspaceService.tryGetRoots().length > 1) {
210
+ rootUri = await this.selectRootUri();
211
+ // Do not continue if the user explicitly does not choose a location.
212
+ if (!rootUri) {
213
+ return;
214
+ }
215
+ }
216
+
217
+ const model = this.getModel(rootUri);
202
218
  if (!model) {
203
219
  return;
204
220
  }
@@ -207,7 +223,7 @@ export class DebugConfigurationManager {
207
223
  return;
208
224
  }
209
225
  const editor = widget.editor.getControl();
210
- const { commandService } = widget.editor;
226
+ const commandService = StandaloneServices.get(ICommandService);
211
227
  let position: monaco.Position | undefined;
212
228
  let depthInArray = 0;
213
229
  let lastProperty = '';
@@ -243,8 +259,24 @@ export class DebugConfigurationManager {
243
259
  await commandService.executeCommand('editor.action.triggerSuggest');
244
260
  }
245
261
 
246
- protected get model(): DebugConfigurationModel | undefined {
247
- const workspaceFolderUri = this.workspaceVariables.getWorkspaceRootUri();
262
+ protected async selectRootUri(): Promise<URI | undefined> {
263
+ const workspaceRoots = this.workspaceService.tryGetRoots();
264
+ const items: QuickPickValue<URI>[] = [];
265
+ for (const workspaceRoot of workspaceRoots) {
266
+ items.push({
267
+ label: this.labelProvider.getName(workspaceRoot.resource),
268
+ description: this.labelProvider.getLongName(workspaceRoot.resource),
269
+ value: workspaceRoot.resource
270
+ });
271
+ }
272
+ const root = await this.quickPickService.show(items, {
273
+ placeholder: nls.localize('theia/debug/addConfigurationPlaceholder', 'Select workspace root to add configuration to')
274
+ });
275
+ return root?.value;
276
+ }
277
+
278
+ protected getModel(uri?: URI): DebugConfigurationModel | undefined {
279
+ const workspaceFolderUri = this.workspaceVariables.getWorkspaceRootUri(uri);
248
280
  if (workspaceFolderUri) {
249
281
  const key = workspaceFolderUri.toString();
250
282
  for (const model of this.models.values()) {
@@ -16,6 +16,7 @@
16
16
 
17
17
  import { AbstractViewContribution, ApplicationShell, KeybindingRegistry, Widget, CompositeTreeNode, LabelProvider, codicon } from '@theia/core/lib/browser';
18
18
  import { injectable, inject } from '@theia/core/shared/inversify';
19
+ import * as monaco from '@theia/monaco-editor-core';
19
20
  import { ThemeService } from '@theia/core/lib/browser/theming';
20
21
  import { MenuModelRegistry, CommandRegistry, MAIN_MENU_BAR, Command, Emitter, Mutable } from '@theia/core/lib/common';
21
22
  import { DebugViewLocation } from '../common/debug-configuration';
@@ -77,7 +77,7 @@ export default new ContainerModule((bind: interfaces.Bind) => {
77
77
  DebugEditorModel.createModel(container, editor)
78
78
  )).inSingletonScope();
79
79
  bind(DebugEditorService).toSelf().inSingletonScope().onActivation((context, service) => {
80
- context.container.get(MonacoEditorService).registerDecorationType(DebugBreakpointWidget.PLACEHOLDER_DECORATION, {});
80
+ context.container.get(MonacoEditorService).registerDecorationType('Debug breakpoint placeholder', DebugBreakpointWidget.PLACEHOLDER_DECORATION, {});
81
81
  return service;
82
82
  });
83
83
 
@@ -25,7 +25,7 @@ import { LabelProvider } from '@theia/core/lib/browser/label-provider';
25
25
  import URI from '@theia/core/lib/common/uri';
26
26
  import { QuickAccessContribution, QuickAccessProvider, QuickAccessRegistry, QuickInputService, StatusBar, StatusBarAlignment } from '@theia/core/lib/browser';
27
27
  import { DebugPreferences } from './debug-preferences';
28
- import { filterItems, QuickPickItem, QuickPicks } from '@theia/core/lib/browser/quick-input/quick-input-service';
28
+ import { filterItems, QuickPickItemOrSeparator, QuickPicks } from '@theia/core/lib/browser/quick-input/quick-input-service';
29
29
  import { CancellationToken } from '@theia/core/lib/common';
30
30
 
31
31
  @injectable()
@@ -108,7 +108,7 @@ export class DebugPrefixConfiguration implements CommandContribution, CommandHan
108
108
  }
109
109
 
110
110
  async getPicks(filter: string, token: CancellationToken): Promise<QuickPicks> {
111
- const items: QuickPickItem[] = [];
111
+ const items: QuickPickItemOrSeparator[] = [];
112
112
  const configurations = this.debugConfigurationManager.all;
113
113
 
114
114
  for (const config of configurations) {
@@ -37,6 +37,7 @@ import { DebugThread } from './model/debug-thread';
37
37
  import { TaskIdentifier } from '@theia/task/lib/common';
38
38
  import { DebugSourceBreakpoint } from './model/debug-source-breakpoint';
39
39
  import { DebugFunctionBreakpoint } from './model/debug-function-breakpoint';
40
+ import * as monaco from '@theia/monaco-editor-core';
40
41
 
41
42
  export interface WillStartDebugSession extends WaitUntilEvent {
42
43
  }
@@ -26,6 +26,15 @@ import { MonacoEditor } from '@theia/monaco/lib/browser/monaco-editor';
26
26
  import { DebugEditor } from './debug-editor';
27
27
  import { DebugSourceBreakpoint } from '../model/debug-source-breakpoint';
28
28
  import { Dimension } from '@theia/editor/lib/browser';
29
+ import * as monaco from '@theia/monaco-editor-core';
30
+ import { LanguageSelector } from '@theia/monaco-editor-core/esm/vs/editor/common/languageSelector';
31
+ import { provideSuggestionItems, CompletionOptions } from '@theia/monaco-editor-core/esm/vs/editor/contrib/suggest/browser/suggest';
32
+ import { IDecorationOptions } from '@theia/monaco-editor-core/esm/vs/editor/common/editorCommon';
33
+ import { StandaloneCodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor';
34
+ import { CompletionItemKind, CompletionContext } from '@theia/monaco-editor-core/esm/vs/editor/common/languages';
35
+ import { ILanguageFeaturesService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/languageFeatures';
36
+ import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
37
+ import { TextModel } from '@theia/monaco-editor-core/esm/vs/editor/common/model/textModel';
29
38
 
30
39
  export type ShowDebugBreakpointOptions = DebugSourceBreakpoint | {
31
40
  position: monaco.Position,
@@ -100,36 +109,38 @@ export class DebugBreakpointWidget implements Disposable {
100
109
  return;
101
110
  }
102
111
  this.toDispose.push(input);
103
- this.toDispose.push(monaco.modes.CompletionProviderRegistry.register({ scheme: input.uri.scheme }, {
104
- provideCompletionItems: async (model, position, context, token) => {
105
- const suggestions = [];
106
- if ((this.context === 'condition' || this.context === 'logMessage')
107
- && input.uri.toString() === model.uri.toString()) {
108
- const editor = this.editor.getControl();
109
- const items = await monaco.suggest.provideSuggestionItems(
110
- editor.getModel()!,
111
- new monaco.Position(editor.getPosition()!.lineNumber, 1),
112
- new monaco.suggest.CompletionOptions(undefined, new Set<monaco.languages.CompletionItemKind>().add(monaco.languages.CompletionItemKind.Snippet)),
113
- context, token);
114
- let overwriteBefore = 0;
115
- if (this.context === 'condition') {
116
- overwriteBefore = position.column - 1;
117
- } else {
118
- // Inside the curly brackets, need to count how many useful characters are behind the position so they would all be taken into account
119
- const value = editor.getModel()!.getValue();
120
- while ((position.column - 2 - overwriteBefore >= 0)
121
- && value[position.column - 2 - overwriteBefore] !== '{' && value[position.column - 2 - overwriteBefore] !== ' ') {
122
- overwriteBefore++;
112
+ this.toDispose.push((monaco.languages.registerCompletionItemProvider as (languageId: LanguageSelector, provider: monaco.languages.CompletionItemProvider) => Disposable)
113
+ ({ scheme: input.uri.scheme }, {
114
+ provideCompletionItems: async (model, position, context, token): Promise<monaco.languages.CompletionList> => {
115
+ const suggestions: monaco.languages.CompletionItem[] = [];
116
+ if ((this.context === 'condition' || this.context === 'logMessage')
117
+ && input.uri.toString() === model.uri.toString()) {
118
+ const editor = this.editor.getControl();
119
+ const completions = await provideSuggestionItems(
120
+ StandaloneServices.get(ILanguageFeaturesService).completionProvider,
121
+ editor.getModel()! as unknown as TextModel,
122
+ new monaco.Position(editor.getPosition()!.lineNumber, 1),
123
+ new CompletionOptions(undefined, new Set<CompletionItemKind>().add(CompletionItemKind.Snippet)),
124
+ context as unknown as CompletionContext, token);
125
+ let overwriteBefore = 0;
126
+ if (this.context === 'condition') {
127
+ overwriteBefore = position.column - 1;
128
+ } else {
129
+ // Inside the curly brackets, need to count how many useful characters are behind the position so they would all be taken into account
130
+ const value = editor.getModel()!.getValue();
131
+ while ((position.column - 2 - overwriteBefore >= 0)
132
+ && value[position.column - 2 - overwriteBefore] !== '{' && value[position.column - 2 - overwriteBefore] !== ' ') {
133
+ overwriteBefore++;
134
+ }
135
+ }
136
+ for (const { completion } of completions.items) {
137
+ completion.range = monaco.Range.fromPositions(position.delta(0, -overwriteBefore), position);
138
+ suggestions.push(completion as unknown as monaco.languages.CompletionItem);
123
139
  }
124
140
  }
125
- for (const { completion } of items) {
126
- completion.range = monaco.Range.fromPositions(position.delta(0, -overwriteBefore), position);
127
- suggestions.push(completion);
128
- }
141
+ return { suggestions };
129
142
  }
130
- return { suggestions };
131
- }
132
- }));
143
+ }));
133
144
  this.toDispose.push(this.zone.onDidLayoutChange(dimension => this.layout(dimension)));
134
145
  this.toDispose.push(input.getControl().onDidChangeModelContent(() => {
135
146
  const heightInLines = input.getControl().getModel()!.getLineCount() + 1;
@@ -230,8 +241,7 @@ export class DebugBreakpointWidget implements Disposable {
230
241
  return;
231
242
  }
232
243
  const value = this._input.getControl().getValue();
233
- const decorations: monaco.editor.IDecorationOptions[] = !!value ? [] : [{
234
- color: undefined,
244
+ const decorations: IDecorationOptions[] = !!value ? [] : [{
235
245
  range: {
236
246
  startLineNumber: 0,
237
247
  endLineNumber: 0,
@@ -245,7 +255,7 @@ export class DebugBreakpointWidget implements Disposable {
245
255
  }
246
256
  }
247
257
  }];
248
- this._input.getControl().setDecorations(DebugBreakpointWidget.PLACEHOLDER_DECORATION, decorations);
258
+ (this._input.getControl() as unknown as StandaloneCodeEditor).setDecorations('Debug breakpoint placeholder', DebugBreakpointWidget.PLACEHOLDER_DECORATION, decorations);
249
259
  }
250
260
  protected get placeholder(): string {
251
261
  if (this.context === 'logMessage') {
@@ -16,6 +16,10 @@
16
16
 
17
17
  import debounce = require('p-debounce');
18
18
  import { injectable, inject, postConstruct, interfaces, Container } from '@theia/core/shared/inversify';
19
+ import * as monaco from '@theia/monaco-editor-core';
20
+ import { IConfigurationService } from '@theia/monaco-editor-core/esm/vs/platform/configuration/common/configuration';
21
+ import { StandaloneCodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor';
22
+ import { IDecorationOptions } from '@theia/monaco-editor-core/esm/vs/editor/common/editorCommon';
19
23
  import URI from '@theia/core/lib/common/uri';
20
24
  import { Disposable, DisposableCollection, MenuPath, isOSX } from '@theia/core';
21
25
  import { ContextMenuRenderer } from '@theia/core/lib/browser';
@@ -90,7 +94,7 @@ export class DebugEditorModel implements Disposable {
90
94
  readonly inlineValueDecorator: DebugInlineValueDecorator;
91
95
 
92
96
  @inject(MonacoConfigurationService)
93
- readonly configurationService: monaco.services.IConfigurationService;
97
+ readonly configurationService: IConfigurationService;
94
98
 
95
99
  @postConstruct()
96
100
  protected init(): void {
@@ -140,9 +144,9 @@ export class DebugEditorModel implements Disposable {
140
144
  const model = codeEditor.getModel()!;
141
145
  const overrides = {
142
146
  resource: model.uri,
143
- overrideIdentifier: model.getLanguageIdentifier().language,
147
+ overrideIdentifier: model.getLanguageId(),
144
148
  };
145
- const { enabled, delay, sticky } = this.configurationService._configuration.getValue('editor.hover', overrides, undefined);
149
+ const { enabled, delay, sticky } = this.configurationService.getValue('editor.hover', overrides);
146
150
  codeEditor.updateOptions({
147
151
  hover: {
148
152
  enabled,
@@ -159,13 +163,13 @@ export class DebugEditorModel implements Disposable {
159
163
  this.createFrameDecorations(),
160
164
  this.createInlineValueDecorations()
161
165
  ]);
162
- const codeEditor = this.editor.getControl();
166
+ const codeEditor = this.editor.getControl() as unknown as StandaloneCodeEditor;
163
167
  codeEditor.removeDecorations(INLINE_VALUE_DECORATION_KEY);
164
- codeEditor.setDecorations(INLINE_VALUE_DECORATION_KEY, inlineValueDecorations);
168
+ codeEditor.setDecorations('Inline debug decorations', INLINE_VALUE_DECORATION_KEY, inlineValueDecorations);
165
169
  this.editorDecorations = this.deltaDecorations(this.editorDecorations, newFrameDecorations);
166
170
  }
167
171
 
168
- protected async createInlineValueDecorations(): Promise<monaco.editor.IDecorationOptions[]> {
172
+ protected async createInlineValueDecorations(): Promise<IDecorationOptions[]> {
169
173
  if (!this.sessions.isCurrentEditorFrame(this.uri)) {
170
174
  return [];
171
175
  }
@@ -15,6 +15,7 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
18
+ import * as monaco from '@theia/monaco-editor-core';
18
19
  import URI from '@theia/core/lib/common/uri';
19
20
  import { EditorManager, EditorWidget } from '@theia/editor/lib/browser';
20
21
  import { ContextMenuRenderer } from '@theia/core/lib/browser';
@@ -16,6 +16,7 @@
16
16
 
17
17
  import * as React from '@theia/core/shared/react';
18
18
  import * as ReactDOM from '@theia/core/shared/react-dom';
19
+ import * as monaco from '@theia/monaco-editor-core';
19
20
  import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
20
21
  import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
21
22
  import { MonacoEditorZoneWidget } from '@theia/monaco/lib/browser/monaco-editor-zone-widget';
@@ -19,6 +19,7 @@
19
19
  *--------------------------------------------------------------------------------------------*/
20
20
 
21
21
  import { injectable } from '@theia/core/shared/inversify';
22
+ import * as monaco from '@theia/monaco-editor-core';
22
23
 
23
24
  /**
24
25
  * TODO: introduce a new request to LSP to look up an expression range: https://github.com/Microsoft/language-server-protocol/issues/462
@@ -27,6 +27,7 @@ import { DebugEditor } from './debug-editor';
27
27
  import { DebugExpressionProvider } from './debug-expression-provider';
28
28
  import { DebugHoverSource } from './debug-hover-source';
29
29
  import { DebugVariable } from '../console/debug-console-items';
30
+ import * as monaco from '@theia/monaco-editor-core';
30
31
 
31
32
  export interface ShowDebugHoverOptions {
32
33
  selection: monaco.Range
@@ -21,6 +21,11 @@
21
21
  // Based on https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts
22
22
 
23
23
  import { inject, injectable } from '@theia/core/shared/inversify';
24
+ import * as monaco from '@theia/monaco-editor-core';
25
+ import { IDecorationOptions } from '@theia/monaco-editor-core/esm/vs/editor/common/editorCommon';
26
+ import { ITextModel } from '@theia/monaco-editor-core/esm/vs/editor/common/model';
27
+ import { StandardTokenType } from '@theia/monaco-editor-core/esm/vs/editor/common/languages';
28
+ import { DEFAULT_WORD_REGEXP } from '@theia/monaco-editor-core/esm/vs/editor/common/core/wordHelper';
24
29
  import { FrontendApplicationContribution } from '@theia/core/lib/browser/frontend-application';
25
30
  import { MonacoEditorService } from '@theia/monaco/lib/browser/monaco-editor-service';
26
31
  import { ExpressionContainer, DebugVariable } from '../console/debug-console-items';
@@ -33,7 +38,6 @@ export const INLINE_VALUE_DECORATION_KEY = 'inlinevaluedecoration';
33
38
  const MAX_NUM_INLINE_VALUES = 100; // JS Global scope can have 700+ entries. We want to limit ourselves for perf reasons
34
39
  const MAX_INLINE_DECORATOR_LENGTH = 150; // Max string length of each inline decorator when debugging. If exceeded ... is added
35
40
  const MAX_TOKENIZATION_LINE_LEN = 500; // If line is too long, then inline values for the line are skipped
36
- const { DEFAULT_WORD_REGEXP } = monaco.wordHelper;
37
41
 
38
42
  /**
39
43
  * MAX SMI (SMall Integer) as defined in v8.
@@ -44,14 +48,6 @@ const { DEFAULT_WORD_REGEXP } = monaco.wordHelper;
44
48
  // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/base/common/uint.ts#L7-L13
45
49
  const MAX_SAFE_SMALL_INTEGER = 1 << 30;
46
50
 
47
- // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/editor/common/modes.ts#L88-L97
48
- const enum StandardTokenType {
49
- Other = 0,
50
- Comment = 1,
51
- String = 2,
52
- RegEx = 4
53
- };
54
-
55
51
  @injectable()
56
52
  export class DebugInlineValueDecorator implements FrontendApplicationContribution {
57
53
 
@@ -62,10 +58,10 @@ export class DebugInlineValueDecorator implements FrontendApplicationContributio
62
58
  protected readonly preferences: DebugPreferences;
63
59
 
64
60
  protected enabled = false;
65
- protected wordToLineNumbersMap: Map<string, monaco.Position[]> | undefined = new Map(); // TODO: can we get rid of this field?
61
+ protected wordToLineNumbersMap: Map<string, monaco.Position[]> | undefined = new Map();
66
62
 
67
63
  onStart(): void {
68
- this.editorService.registerDecorationType(INLINE_VALUE_DECORATION_KEY, {});
64
+ this.editorService.registerDecorationType('Inline debug decorations', INLINE_VALUE_DECORATION_KEY, {});
69
65
  this.enabled = !!this.preferences['debug.inlineValues'];
70
66
  this.preferences.onPreferenceChanged(({ preferenceName, newValue }) => {
71
67
  if (preferenceName === 'debug.inlineValues' && !!newValue !== this.enabled) {
@@ -74,7 +70,7 @@ export class DebugInlineValueDecorator implements FrontendApplicationContributio
74
70
  });
75
71
  }
76
72
 
77
- async calculateDecorations(debugEditorModel: DebugEditorModel, stackFrame: DebugStackFrame | undefined): Promise<monaco.editor.IDecorationOptions[]> {
73
+ async calculateDecorations(debugEditorModel: DebugEditorModel, stackFrame: DebugStackFrame | undefined): Promise<IDecorationOptions[]> {
78
74
  this.wordToLineNumbersMap = undefined;
79
75
  const model = debugEditorModel.editor.getControl().getModel() || undefined;
80
76
  return this.updateInlineValueDecorations(model, stackFrame);
@@ -83,7 +79,7 @@ export class DebugInlineValueDecorator implements FrontendApplicationContributio
83
79
  // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts#L382-L408
84
80
  protected async updateInlineValueDecorations(
85
81
  model: monaco.editor.ITextModel | undefined,
86
- stackFrame: DebugStackFrame | undefined): Promise<monaco.editor.IDecorationOptions[]> {
82
+ stackFrame: DebugStackFrame | undefined): Promise<IDecorationOptions[]> {
87
83
 
88
84
  if (!this.enabled || !model || !stackFrame || !stackFrame.source || model.uri.toString() !== stackFrame.source.uri.toString()) {
89
85
  return [];
@@ -115,7 +111,7 @@ export class DebugInlineValueDecorator implements FrontendApplicationContributio
115
111
  private createInlineValueDecorationsInsideRange(
116
112
  expressions: ReadonlyArray<ExpressionContainer>,
117
113
  range: monaco.Range,
118
- model: monaco.editor.ITextModel): monaco.editor.IDecorationOptions[] {
114
+ model: monaco.editor.ITextModel): IDecorationOptions[] {
119
115
 
120
116
  const nameValueMap = new Map<string, string>();
121
117
  for (const expr of expressions) {
@@ -149,7 +145,7 @@ export class DebugInlineValueDecorator implements FrontendApplicationContributio
149
145
  }
150
146
  });
151
147
 
152
- const decorations: monaco.editor.IDecorationOptions[] = [];
148
+ const decorations: IDecorationOptions[] = [];
153
149
  // Compute decorators for each line
154
150
  lineToNamesMap.forEach((names, line) => {
155
151
  const contentText = names.sort((first, second) => {
@@ -163,14 +159,13 @@ export class DebugInlineValueDecorator implements FrontendApplicationContributio
163
159
  }
164
160
 
165
161
  // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts#L454-L485
166
- private createInlineValueDecoration(lineNumber: number, contentText: string): monaco.editor.IDecorationOptions {
162
+ private createInlineValueDecoration(lineNumber: number, contentText: string): IDecorationOptions {
167
163
  // If decoratorText is too long, trim and add ellipses. This could happen for minified files with everything on a single line
168
164
  if (contentText.length > MAX_INLINE_DECORATOR_LENGTH) {
169
165
  contentText = contentText.substr(0, MAX_INLINE_DECORATOR_LENGTH) + '...';
170
166
  }
171
167
 
172
168
  return {
173
- color: undefined, // XXX: check inconsistency between APIs. `color` seems to be mandatory from `monaco-editor-core`.
174
169
  range: {
175
170
  startLineNumber: lineNumber,
176
171
  endLineNumber: lineNumber,
@@ -198,7 +193,8 @@ export class DebugInlineValueDecorator implements FrontendApplicationContributio
198
193
  }
199
194
 
200
195
  // https://github.com/theia-ide/vscode/blob/standalone/0.19.x/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts#L487-L531
201
- private getWordToPositionsMap(model: monaco.editor.ITextModel): Map<string, monaco.Position[]> {
196
+ private getWordToPositionsMap(model: monaco.editor.ITextModel | ITextModel): Map<string, monaco.Position[]> {
197
+ model = model as ITextModel;
202
198
  if (!this.wordToLineNumbersMap) {
203
199
  this.wordToLineNumbersMap = new Map<string, monaco.Position[]>();
204
200
  if (!model) {
@@ -30,6 +30,7 @@ import { DebugSource } from './debug-source';
30
30
  import { RecursivePartial } from '@theia/core';
31
31
  import { DebugSession } from '../debug-session';
32
32
  import { DebugThread } from './debug-thread';
33
+ import * as monaco from '@theia/monaco-editor-core';
33
34
 
34
35
  export class DebugStackFrameData {
35
36
  readonly raw: DebugProtocol.StackFrame;
@@ -114,14 +114,9 @@
114
114
  display: flex;
115
115
  align-items: center;
116
116
  padding-top: calc(var(--theia-ui-padding)*2);
117
- padding-right: calc(var(--theia-ui-padding)*2);
117
+ padding-right: calc(var(--theia-ui-padding)*3);
118
118
  padding-bottom: var(--theia-ui-padding);
119
- margin-right: var(--theia-ui-padding);
120
- margin-left: var(--theia-ui-padding);
121
- }
122
-
123
- .theia-side-panel .debug-toolbar {
124
- padding-left: 3px;
119
+ padding-left: calc(var(--theia-ui-padding)*2);
125
120
  }
126
121
 
127
122
  .theia-session-container > .debug-toolbar {
@@ -1,18 +0,0 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- // eslint-disable-next-line spaced-comment
18
- /// <reference types='@theia/monaco/src/typings/monaco'/>