@theia/debug 1.57.1 → 1.58.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 (33) hide show
  1. package/lib/browser/debug-frontend-application-contribution.d.ts +4 -0
  2. package/lib/browser/debug-frontend-application-contribution.d.ts.map +1 -1
  3. package/lib/browser/debug-frontend-application-contribution.js +30 -1
  4. package/lib/browser/debug-frontend-application-contribution.js.map +1 -1
  5. package/lib/browser/debug-schema-updater.d.ts +2 -3
  6. package/lib/browser/debug-schema-updater.d.ts.map +1 -1
  7. package/lib/browser/debug-schema-updater.js +6 -6
  8. package/lib/browser/debug-schema-updater.js.map +1 -1
  9. package/lib/browser/debug-session.d.ts +2 -1
  10. package/lib/browser/debug-session.d.ts.map +1 -1
  11. package/lib/browser/debug-session.js +12 -8
  12. package/lib/browser/debug-session.js.map +1 -1
  13. package/lib/browser/disassembly-view/disassembly-view-widget.js +3 -3
  14. package/lib/browser/disassembly-view/disassembly-view-widget.js.map +1 -1
  15. package/lib/browser/editor/debug-editor-service.d.ts +2 -0
  16. package/lib/browser/editor/debug-editor-service.d.ts.map +1 -1
  17. package/lib/browser/editor/debug-editor-service.js +4 -0
  18. package/lib/browser/editor/debug-editor-service.js.map +1 -1
  19. package/lib/browser/model/debug-thread.d.ts +4 -0
  20. package/lib/browser/model/debug-thread.d.ts.map +1 -1
  21. package/lib/browser/model/debug-thread.js +17 -0
  22. package/lib/browser/model/debug-thread.js.map +1 -1
  23. package/lib/common/inline-debug-adapter.d.ts +1 -0
  24. package/lib/common/inline-debug-adapter.d.ts.map +1 -1
  25. package/lib/node/stream-debug-adapter.d.ts +1 -0
  26. package/lib/node/stream-debug-adapter.d.ts.map +1 -1
  27. package/package.json +17 -17
  28. package/src/browser/debug-frontend-application-contribution.ts +39 -2
  29. package/src/browser/debug-schema-updater.ts +5 -7
  30. package/src/browser/debug-session.tsx +13 -8
  31. package/src/browser/disassembly-view/disassembly-view-widget.ts +3 -3
  32. package/src/browser/editor/debug-editor-service.ts +6 -0
  33. package/src/browser/model/debug-thread.tsx +28 -4
@@ -15,8 +15,8 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
18
- import { JsonSchemaRegisterContext, JsonSchemaContribution } from '@theia/core/lib/browser/json-schema-store';
19
- import { InMemoryResources, deepClone, nls } from '@theia/core/lib/common';
18
+ import { JsonSchemaRegisterContext, JsonSchemaContribution, JsonSchemaDataStore } from '@theia/core/lib/browser/json-schema-store';
19
+ import { deepClone, nls } from '@theia/core/lib/common';
20
20
  import { IJSONSchema } from '@theia/core/lib/common/json-schema';
21
21
  import URI from '@theia/core/lib/common/uri';
22
22
  import { DebugService } from '../common/debug-service';
@@ -30,13 +30,13 @@ export class DebugSchemaUpdater implements JsonSchemaContribution {
30
30
 
31
31
  protected readonly uri = new URI(launchSchemaId);
32
32
 
33
- @inject(InMemoryResources) protected readonly inmemoryResources: InMemoryResources;
33
+ @inject(JsonSchemaDataStore) protected readonly jsonStorage: JsonSchemaDataStore;
34
34
  @inject(WorkspaceService) protected readonly workspaceService: WorkspaceService;
35
35
  @inject(DebugService) protected readonly debug: DebugService;
36
36
 
37
37
  @postConstruct()
38
38
  protected init(): void {
39
- this.inmemoryResources.add(this.uri, '');
39
+ this.jsonStorage.setSchema(this.uri, '');
40
40
  }
41
41
 
42
42
  registerSchemas(context: JsonSchemaRegisterContext): void {
@@ -64,9 +64,7 @@ export class DebugSchemaUpdater implements JsonSchemaContribution {
64
64
  }
65
65
  }
66
66
  items.defaultSnippets!.push(...await this.debug.getConfigurationSnippets());
67
-
68
- const contents = JSON.stringify(schema);
69
- this.inmemoryResources.update(this.uri, contents);
67
+ this.jsonStorage.setSchema(this.uri, schema);
70
68
  }
71
69
  }
72
70
 
@@ -312,6 +312,16 @@ export class DebugSession implements CompositeTreeElement {
312
312
  return currentFrame ? currentFrame.getScopes() : [];
313
313
  }
314
314
 
315
+ showMessage(messageType: MessageType, message: string): void {
316
+ this.messages.showMessage({
317
+ type: messageType,
318
+ text: message,
319
+ options: {
320
+ timeout: 10000
321
+ }
322
+ });
323
+ }
324
+
315
325
  async start(): Promise<void> {
316
326
  await this.initialize();
317
327
  await this.launchOrAttach();
@@ -343,13 +353,7 @@ export class DebugSession implements CompositeTreeElement {
343
353
  try {
344
354
  await this.sendRequest((this.configuration.request as keyof DebugRequestTypes), this.configuration);
345
355
  } catch (reason) {
346
- this.messages.showMessage({
347
- type: MessageType.Error,
348
- text: reason.message || 'Debug session initialization failed. See console for details.',
349
- options: {
350
- timeout: 10000
351
- }
352
- });
356
+ this.showMessage(MessageType.Error, reason.message || 'Debug session initialization failed. See console for details.');
353
357
  throw reason;
354
358
  }
355
359
  }
@@ -373,11 +377,12 @@ export class DebugSession implements CompositeTreeElement {
373
377
  }
374
378
  this.breakpoints.setExceptionBreakpoints(exceptionBreakpoints);
375
379
  }
380
+ // mark as initialized, so updated breakpoints are shown in editor
381
+ this.initialized = true;
376
382
  await this.updateBreakpoints({ sourceModified: false });
377
383
  if (this.capabilities.supportsConfigurationDoneRequest) {
378
384
  await this.sendRequest('configurationDone', {});
379
385
  }
380
- this.initialized = true;
381
386
  await this.updateThreads(undefined);
382
387
  }
383
388
 
@@ -27,7 +27,7 @@ import { BareFontInfo } from '@theia/monaco-editor-core/esm/vs/editor/common/con
27
27
  import { WorkbenchTable } from '@theia/monaco-editor-core/esm/vs/platform/list/browser/listService';
28
28
  import { DebugState, DebugSession } from '../debug-session';
29
29
  import { EditorPreferences } from '@theia/editor/lib/browser';
30
- import { PixelRatio } from '@theia/monaco-editor-core/esm/vs/base/browser/browser';
30
+ import { PixelRatio } from '@theia/monaco-editor-core/esm/vs/base/browser/pixelRatio';
31
31
  import { DebugPreferences } from '../debug-preferences';
32
32
  import { DebugThread } from '../model/debug-thread';
33
33
  import { Event } from '@theia/monaco-editor-core/esm/vs/base/common/event';
@@ -89,8 +89,8 @@ export class DisassemblyViewWidget extends BaseWidget {
89
89
  this.node.tabIndex = -1;
90
90
  this.node.style.outline = 'none';
91
91
  this._previousDebuggingState = this.debugSessionManager.currentSession?.state ?? DebugState.Inactive;
92
- this._fontInfo = BareFontInfo.createFromRawSettings(this.toFontInfo(), PixelRatio.value);
93
- this.editorPreferences.onPreferenceChanged(() => this._fontInfo = BareFontInfo.createFromRawSettings(this.toFontInfo(), PixelRatio.value));
92
+ this._fontInfo = BareFontInfo.createFromRawSettings(this.toFontInfo(), PixelRatio.getInstance(window).value);
93
+ this.editorPreferences.onPreferenceChanged(() => this._fontInfo = BareFontInfo.createFromRawSettings(this.toFontInfo(), PixelRatio.getInstance(window).value));
94
94
  this.debugPreferences.onPreferenceChanged(e => {
95
95
  if (e.preferenceName === 'debug.disassemblyView.showSourceCode' && e.newValue !== this._enableSourceCodeRender) {
96
96
  this._enableSourceCodeRender = e.newValue;
@@ -24,6 +24,7 @@ import { DebugEditorModel, DebugEditorModelFactory } from './debug-editor-model'
24
24
  import { BreakpointManager, SourceBreakpointsChangeEvent } from '../breakpoint/breakpoint-manager';
25
25
  import { DebugSourceBreakpoint } from '../model/debug-source-breakpoint';
26
26
  import { DebugBreakpointWidget } from './debug-breakpoint-widget';
27
+ import URI from '@theia/core/lib/common/uri';
27
28
 
28
29
  @injectable()
29
30
  export class DebugEditorService {
@@ -71,6 +72,11 @@ export class DebugEditorService {
71
72
  return uri && this.models.get(uri.toString());
72
73
  }
73
74
 
75
+ get currentUri(): URI | undefined {
76
+ const { currentEditor } = this.editors;
77
+ return currentEditor && currentEditor.getResourceUri();
78
+ }
79
+
74
80
  getLogpoint(position: monaco.Position): DebugSourceBreakpoint | undefined {
75
81
  const logpoint = this.anyBreakpoint(position);
76
82
  return logpoint && logpoint.logMessage ? logpoint : undefined;
@@ -15,11 +15,13 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import * as React from '@theia/core/shared/react';
18
- import { CancellationTokenSource, Emitter, Event, nls } from '@theia/core';
18
+ import { CancellationTokenSource, Emitter, Event, MessageType, nls } from '@theia/core';
19
19
  import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
20
20
  import { TreeElement } from '@theia/core/lib/browser/source-tree';
21
21
  import { DebugStackFrame } from './debug-stack-frame';
22
22
  import { DebugSession } from '../debug-session';
23
+ import * as monaco from '@theia/monaco-editor-core';
24
+ import URI from '@theia/core/lib/common/uri';
23
25
 
24
26
  export type StoppedDetails = DebugProtocol.StoppedEvent['body'] & {
25
27
  framesErrorMessage?: string
@@ -111,6 +113,28 @@ export class DebugThread extends DebugThreadData implements TreeElement {
111
113
  return this.session.sendRequest('pause', this.toArgs());
112
114
  }
113
115
 
116
+ get supportsGoto(): boolean {
117
+ return !!this.session.capabilities.supportsGotoTargetsRequest;
118
+ }
119
+
120
+ async jumpToCursor(uri: URI, position: monaco.Position): Promise<DebugProtocol.GotoResponse | undefined> {
121
+ const source = await this.session?.toDebugSource(uri);
122
+
123
+ if (!source) {
124
+ return undefined;
125
+ }
126
+
127
+ const response: DebugProtocol.GotoTargetsResponse = await this.session.sendRequest('gotoTargets', { source, line: position.lineNumber, column: position.column });
128
+
129
+ if (response && response.body.targets.length === 0) {
130
+ this.session.showMessage(MessageType.Warning, 'No executable code is associated at the current cursor position.');
131
+ return;
132
+ }
133
+
134
+ const targetId = response.body.targets[0].id;
135
+ return this.session.sendRequest('goto', this.toArgs({ targetId }));
136
+ }
137
+
114
138
  async getExceptionInfo(): Promise<DebugExceptionInfo | undefined> {
115
139
  if (this.stoppedDetails && this.stoppedDetails.reason === 'exception') {
116
140
  if (this.session.capabilities.supportsExceptionInfoRequest) {
@@ -261,8 +285,8 @@ export class DebugThread extends DebugThreadData implements TreeElement {
261
285
  const localizedReason = this.getLocalizedReason(reason);
262
286
 
263
287
  return reason
264
- ? nls.localizeByDefault('Paused on {0}', localizedReason)
265
- : nls.localizeByDefault('Paused');
288
+ ? nls.localizeByDefault('Paused on {0}', localizedReason)
289
+ : nls.localizeByDefault('Paused');
266
290
  }
267
291
 
268
292
  protected getLocalizedReason(reason: string | undefined): string {
@@ -281,7 +305,7 @@ export class DebugThread extends DebugThreadData implements TreeElement {
281
305
  return nls.localize('theia/debug/goto', 'goto');
282
306
  case 'function breakpoint':
283
307
  return nls.localize('theia/debug/functionBreakpoint', 'function breakpoint');
284
- case 'data breakpoint':
308
+ case 'data breakpoint':
285
309
  return nls.localize('theia/debug/dataBreakpoint', 'data breakpoint');
286
310
  case 'instruction breakpoint':
287
311
  return nls.localize('theia/debug/instructionBreakpoint', 'instruction breakpoint');