@opensumi/ide-debug 2.24.6-rc-1685671765.0 → 2.25.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/lib/browser/components/floating-click-widget/index.d.ts.map +1 -1
- package/lib/browser/components/floating-click-widget/index.js +3 -2
- package/lib/browser/components/floating-click-widget/index.js.map +1 -1
- package/lib/browser/components/floating-click-widget/index.module.less +4 -0
- package/lib/browser/debug-configuration-manager.d.ts +6 -0
- package/lib/browser/debug-configuration-manager.d.ts.map +1 -1
- package/lib/browser/debug-configuration-manager.js +64 -17
- package/lib/browser/debug-configuration-manager.js.map +1 -1
- package/lib/browser/debug-contribution.d.ts.map +1 -1
- package/lib/browser/debug-contribution.js +11 -3
- package/lib/browser/debug-contribution.js.map +1 -1
- package/lib/browser/{debug-schema-updater.d.ts → debug-schema-manager.d.ts} +2 -2
- package/lib/browser/debug-schema-manager.d.ts.map +1 -0
- package/lib/browser/{debug-schema-updater.js → debug-schema-manager.js} +10 -10
- package/lib/browser/debug-schema-manager.js.map +1 -0
- package/lib/browser/debugUtils.d.ts +1 -0
- package/lib/browser/debugUtils.d.ts.map +1 -1
- package/lib/browser/debugUtils.js +22 -1
- package/lib/browser/debugUtils.js.map +1 -1
- package/lib/browser/editor/debug-breakpoint-zone-widget.d.ts +2 -0
- package/lib/browser/editor/debug-breakpoint-zone-widget.d.ts.map +1 -1
- package/lib/browser/editor/debug-breakpoint-zone-widget.js +14 -0
- package/lib/browser/editor/debug-breakpoint-zone-widget.js.map +1 -1
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +5 -0
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/preferences/components/checkbox-widget.d.ts +4 -0
- package/lib/browser/preferences/components/checkbox-widget.d.ts.map +1 -0
- package/lib/browser/preferences/components/checkbox-widget.js +27 -0
- package/lib/browser/preferences/components/checkbox-widget.js.map +1 -0
- package/lib/browser/preferences/components/fields/any-of-field.d.ts +4 -0
- package/lib/browser/preferences/components/fields/any-of-field.d.ts.map +1 -0
- package/lib/browser/preferences/components/fields/any-of-field.js +28 -0
- package/lib/browser/preferences/components/fields/any-of-field.js.map +1 -0
- package/lib/browser/preferences/components/fields/array-field.d.ts +5 -0
- package/lib/browser/preferences/components/fields/array-field.d.ts.map +1 -0
- package/lib/browser/preferences/components/fields/array-field.js +19 -0
- package/lib/browser/preferences/components/fields/array-field.js.map +1 -0
- package/lib/browser/preferences/components/fields/object-filed.d.ts +5 -0
- package/lib/browser/preferences/components/fields/object-filed.d.ts.map +1 -0
- package/lib/browser/preferences/components/fields/object-filed.js +26 -0
- package/lib/browser/preferences/components/fields/object-filed.js.map +1 -0
- package/lib/browser/preferences/components/fields/title-field.d.ts +4 -0
- package/lib/browser/preferences/components/fields/title-field.d.ts.map +1 -0
- package/lib/browser/preferences/components/fields/title-field.js +12 -0
- package/lib/browser/preferences/components/fields/title-field.js.map +1 -0
- package/lib/browser/preferences/components/json-widget.module.less +36 -0
- package/lib/browser/preferences/components/select-widget.d.ts +4 -0
- package/lib/browser/preferences/components/select-widget.d.ts.map +1 -0
- package/lib/browser/preferences/components/select-widget.js +28 -0
- package/lib/browser/preferences/components/select-widget.js.map +1 -0
- package/lib/browser/preferences/components/text-widget.d.ts +4 -0
- package/lib/browser/preferences/components/text-widget.d.ts.map +1 -0
- package/lib/browser/preferences/components/text-widget.js +41 -0
- package/lib/browser/preferences/components/text-widget.js.map +1 -0
- package/lib/browser/preferences/launch-preferences-contribution.d.ts +14 -2
- package/lib/browser/preferences/launch-preferences-contribution.d.ts.map +1 -1
- package/lib/browser/preferences/launch-preferences-contribution.js +61 -2
- package/lib/browser/preferences/launch-preferences-contribution.js.map +1 -1
- package/lib/browser/preferences/launch.module.less +102 -0
- package/lib/browser/preferences/launch.service.d.ts +31 -0
- package/lib/browser/preferences/launch.service.d.ts.map +1 -0
- package/lib/browser/preferences/launch.service.js +109 -0
- package/lib/browser/preferences/launch.service.js.map +1 -0
- package/lib/browser/preferences/launch.view.d.ts +3 -0
- package/lib/browser/preferences/launch.view.d.ts.map +1 -0
- package/lib/browser/preferences/launch.view.js +287 -0
- package/lib/browser/preferences/launch.view.js.map +1 -0
- package/lib/browser/preferences/model/configuration-items.d.ts +12 -0
- package/lib/browser/preferences/model/configuration-items.d.ts.map +1 -0
- package/lib/browser/preferences/model/configuration-items.js +22 -0
- package/lib/browser/preferences/model/configuration-items.js.map +1 -0
- package/lib/browser/preferences/templates/additional-template.d.ts +4 -0
- package/lib/browser/preferences/templates/additional-template.d.ts.map +1 -0
- package/lib/browser/preferences/templates/additional-template.js +30 -0
- package/lib/browser/preferences/templates/additional-template.js.map +1 -0
- package/lib/browser/preferences/templates/array-field-item-template.d.ts +4 -0
- package/lib/browser/preferences/templates/array-field-item-template.d.ts.map +1 -0
- package/lib/browser/preferences/templates/array-field-item-template.js +31 -0
- package/lib/browser/preferences/templates/array-field-item-template.js.map +1 -0
- package/lib/browser/preferences/templates/array-field-template.d.ts +4 -0
- package/lib/browser/preferences/templates/array-field-template.d.ts.map +1 -0
- package/lib/browser/preferences/templates/array-field-template.js +31 -0
- package/lib/browser/preferences/templates/array-field-template.js.map +1 -0
- package/lib/browser/preferences/templates/base-input-template.d.ts +4 -0
- package/lib/browser/preferences/templates/base-input-template.d.ts.map +1 -0
- package/lib/browser/preferences/templates/base-input-template.js +29 -0
- package/lib/browser/preferences/templates/base-input-template.js.map +1 -0
- package/lib/browser/preferences/templates/button-template.d.ts +12 -0
- package/lib/browser/preferences/templates/button-template.d.ts.map +1 -0
- package/lib/browser/preferences/templates/button-template.js +71 -0
- package/lib/browser/preferences/templates/button-template.js.map +1 -0
- package/lib/browser/preferences/templates/description-field-template.d.ts +4 -0
- package/lib/browser/preferences/templates/description-field-template.d.ts.map +1 -0
- package/lib/browser/preferences/templates/description-field-template.js +16 -0
- package/lib/browser/preferences/templates/description-field-template.js.map +1 -0
- package/lib/browser/preferences/templates/field-template.d.ts +4 -0
- package/lib/browser/preferences/templates/field-template.d.ts.map +1 -0
- package/lib/browser/preferences/templates/field-template.js +19 -0
- package/lib/browser/preferences/templates/field-template.js.map +1 -0
- package/lib/browser/preferences/templates/json-templates.module.less +133 -0
- package/lib/browser/preferences/templates/object-field-template.d.ts +4 -0
- package/lib/browser/preferences/templates/object-field-template.d.ts.map +1 -0
- package/lib/browser/preferences/templates/object-field-template.js +74 -0
- package/lib/browser/preferences/templates/object-field-template.js.map +1 -0
- package/lib/browser/view/breakpoints/debug-breakpoints.module.less +19 -17
- package/lib/browser/view/breakpoints/debug-breakpoints.view.d.ts.map +1 -1
- package/lib/browser/view/breakpoints/debug-breakpoints.view.js +15 -7
- package/lib/browser/view/breakpoints/debug-breakpoints.view.js.map +1 -1
- package/lib/browser/view/configuration/debug-configuration.service.d.ts +1 -0
- package/lib/browser/view/configuration/debug-configuration.service.d.ts.map +1 -1
- package/lib/browser/view/configuration/debug-configuration.service.js +3 -0
- package/lib/browser/view/configuration/debug-configuration.service.js.map +1 -1
- package/lib/common/constants.d.ts +2 -0
- package/lib/common/constants.d.ts.map +1 -1
- package/lib/common/constants.js +4 -2
- package/lib/common/constants.js.map +1 -1
- package/lib/common/debug-schema.d.ts +5 -0
- package/lib/common/debug-schema.d.ts.map +1 -0
- package/lib/common/debug-schema.js +7 -0
- package/lib/common/debug-schema.js.map +1 -0
- package/lib/common/debug-service.d.ts +10 -0
- package/lib/common/debug-service.d.ts.map +1 -1
- package/lib/common/debug-service.js +8 -1
- package/lib/common/debug-service.js.map +1 -1
- package/lib/common/index.d.ts +1 -1
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +1 -1
- package/lib/common/index.js.map +1 -1
- package/package.json +26 -23
- package/src/browser/components/floating-click-widget/index.module.less +4 -0
- package/src/browser/components/floating-click-widget/index.tsx +4 -1
- package/src/browser/debug-configuration-manager.ts +82 -18
- package/src/browser/debug-contribution.ts +12 -4
- package/src/browser/{debug-schema-updater.ts → debug-schema-manager.ts} +5 -4
- package/src/browser/debugUtils.ts +23 -0
- package/src/browser/editor/debug-breakpoint-zone-widget.tsx +16 -1
- package/src/browser/index.ts +6 -0
- package/src/browser/preferences/components/checkbox-widget.tsx +78 -0
- package/src/browser/preferences/components/fields/any-of-field.tsx +90 -0
- package/src/browser/preferences/components/fields/array-field.tsx +25 -0
- package/src/browser/preferences/components/fields/object-filed.tsx +33 -0
- package/src/browser/preferences/components/fields/title-field.tsx +16 -0
- package/src/browser/preferences/components/json-widget.module.less +36 -0
- package/src/browser/preferences/components/select-widget.tsx +68 -0
- package/src/browser/preferences/components/text-widget.tsx +114 -0
- package/src/browser/preferences/launch-preferences-contribution.ts +84 -3
- package/src/browser/preferences/launch.module.less +102 -0
- package/src/browser/preferences/launch.service.ts +133 -0
- package/src/browser/preferences/launch.view.tsx +494 -0
- package/src/browser/preferences/model/configuration-items.ts +24 -0
- package/src/browser/preferences/templates/additional-template.tsx +77 -0
- package/src/browser/preferences/templates/array-field-item-template.tsx +90 -0
- package/src/browser/preferences/templates/array-field-template.tsx +92 -0
- package/src/browser/preferences/templates/base-input-template.tsx +79 -0
- package/src/browser/preferences/templates/button-template.tsx +107 -0
- package/src/browser/preferences/templates/description-field-template.tsx +29 -0
- package/src/browser/preferences/templates/field-template.tsx +71 -0
- package/src/browser/preferences/templates/json-templates.module.less +133 -0
- package/src/browser/preferences/templates/object-field-template.tsx +156 -0
- package/src/browser/view/breakpoints/debug-breakpoints.module.less +19 -17
- package/src/browser/view/breakpoints/debug-breakpoints.view.tsx +22 -10
- package/src/browser/view/configuration/debug-configuration.service.ts +4 -0
- package/src/common/constants.ts +3 -0
- package/src/common/debug-schema.ts +5 -0
- package/src/common/debug-service.ts +13 -0
- package/src/common/index.ts +1 -1
- package/lib/browser/debug-schema-updater.d.ts.map +0 -1
- package/lib/browser/debug-schema-updater.js.map +0 -1
- package/lib/common/debug-schema-updater.d.ts +0 -3
- package/lib/common/debug-schema-updater.d.ts.map +0 -1
- package/lib/common/debug-schema-updater.js +0 -5
- package/lib/common/debug-schema-updater.js.map +0 -1
- package/src/common/debug-schema-updater.ts +0 -3
|
@@ -20,19 +20,22 @@ import {
|
|
|
20
20
|
CommonLanguageId,
|
|
21
21
|
} from '@opensumi/ide-core-browser';
|
|
22
22
|
import { WorkbenchEditorService, IOpenResourceResult } from '@opensumi/ide-editor';
|
|
23
|
+
import { EditorCollectionService, IEditorDocumentModelService } from '@opensumi/ide-editor/lib/browser/index';
|
|
23
24
|
import { IFileServiceClient } from '@opensumi/ide-file-service';
|
|
24
25
|
import { FileSystemError } from '@opensumi/ide-file-service';
|
|
26
|
+
import { EOL } from '@opensumi/ide-monaco';
|
|
25
27
|
import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types';
|
|
26
28
|
import { QuickPickService } from '@opensumi/ide-quick-open';
|
|
27
29
|
import { IWorkspaceService } from '@opensumi/ide-workspace';
|
|
28
30
|
import { WorkspaceVariableContribution } from '@opensumi/ide-workspace/lib/browser/workspace-variable-contribution';
|
|
31
|
+
import { EditOperation } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/editOperation';
|
|
29
32
|
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
30
33
|
|
|
31
34
|
import { DebugServer, IDebugServer, IDebuggerContribution, launchSchemaUri } from '../common';
|
|
32
35
|
import { DebugSessionOptions } from '../common';
|
|
33
36
|
import { DebugConfiguration } from '../common';
|
|
34
37
|
|
|
35
|
-
import { CONTEXT_DEBUGGERS_AVAILABLE } from './../common/constants';
|
|
38
|
+
import { CONTEXT_DEBUGGERS_AVAILABLE, LAUNCH_VIEW_SCHEME } from './../common/constants';
|
|
36
39
|
import { DebugConfigurationModel } from './debug-configuration-model';
|
|
37
40
|
import { DebugPreferences } from './debug-preferences';
|
|
38
41
|
|
|
@@ -87,6 +90,12 @@ export class DebugConfigurationManager {
|
|
|
87
90
|
@Autowired(DebugPreferences)
|
|
88
91
|
protected readonly debugPreferences: DebugPreferences;
|
|
89
92
|
|
|
93
|
+
@Autowired(IEditorDocumentModelService)
|
|
94
|
+
protected readonly documentService: IEditorDocumentModelService;
|
|
95
|
+
|
|
96
|
+
@Autowired(EditorCollectionService)
|
|
97
|
+
protected readonly editorCollectionService: EditorCollectionService;
|
|
98
|
+
|
|
90
99
|
private contextDebuggersAvailable: IContextKey<boolean>;
|
|
91
100
|
|
|
92
101
|
// 用于存储支持断点的语言
|
|
@@ -266,36 +275,32 @@ export class DebugConfigurationManager {
|
|
|
266
275
|
}
|
|
267
276
|
}
|
|
268
277
|
|
|
269
|
-
async
|
|
270
|
-
|
|
271
|
-
if (uri) {
|
|
272
|
-
model = this.getModelByUri(uri);
|
|
273
|
-
} else {
|
|
274
|
-
model = this.model;
|
|
275
|
-
}
|
|
276
|
-
if (!model) {
|
|
278
|
+
async openLaunchEditor(): Promise<void> {
|
|
279
|
+
if (!this.model) {
|
|
277
280
|
return;
|
|
278
281
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
const { group } = resouce;
|
|
284
|
-
const editor = group.codeEditor.monacoEditor;
|
|
285
|
-
if (!editor) {
|
|
282
|
+
|
|
283
|
+
const uri = this.model.uri;
|
|
284
|
+
if (!uri) {
|
|
286
285
|
return;
|
|
287
286
|
}
|
|
288
287
|
|
|
288
|
+
await this.workbenchEditorService.open(uri.withScheme(LAUNCH_VIEW_SCHEME), {
|
|
289
|
+
disableNavigate: true,
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
private visitConfigurationsEditor(model: ITextModel): monaco.Position | undefined {
|
|
289
294
|
let position: monaco.Position | undefined;
|
|
290
295
|
let depthInArray = 0;
|
|
291
296
|
let lastProperty = '';
|
|
292
|
-
visit(
|
|
297
|
+
visit(model.getValue(), {
|
|
293
298
|
onObjectProperty: (property) => {
|
|
294
299
|
lastProperty = property;
|
|
295
300
|
},
|
|
296
301
|
onArrayBegin: (offset) => {
|
|
297
302
|
if (lastProperty === 'configurations' && depthInArray === 0) {
|
|
298
|
-
position =
|
|
303
|
+
position = model.getPositionAt(offset + 1);
|
|
299
304
|
}
|
|
300
305
|
depthInArray++;
|
|
301
306
|
},
|
|
@@ -303,9 +308,68 @@ export class DebugConfigurationManager {
|
|
|
303
308
|
depthInArray--;
|
|
304
309
|
},
|
|
305
310
|
});
|
|
311
|
+
|
|
312
|
+
return position;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
async insertConfiguration(uri: URI, configuration: DebugConfiguration): Promise<void> {
|
|
316
|
+
let ref = this.documentService.getModelReference(uri);
|
|
317
|
+
if (!ref) {
|
|
318
|
+
ref = await this.documentService.createModelReference(uri);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
const model = ref.instance.getMonacoModel();
|
|
322
|
+
const eol = model.getEOL();
|
|
323
|
+
const position: monaco.Position | undefined = this.visitConfigurationsEditor(model);
|
|
324
|
+
if (!position) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const { indentSize, insertSpaces } = model.getOptions();
|
|
329
|
+
// 获取 configurations 字符串前面的空格个数
|
|
330
|
+
const spacesMatch = model.getLineContent(position.lineNumber).match(/^\s*/);
|
|
331
|
+
const leadingSpaces = spacesMatch ? spacesMatch[0].length : 0;
|
|
332
|
+
const indent = insertSpaces ? ' '.repeat(indentSize + leadingSpaces) : '\t';
|
|
333
|
+
|
|
334
|
+
const decompose = JSON.stringify(configuration, null, indentSize).split(EOL.LF);
|
|
335
|
+
const length = decompose.length;
|
|
336
|
+
const indentContent = decompose.reduce(
|
|
337
|
+
(pre, cur, index) => pre + indent + cur + (index === length - 1 ? '' : EOL.LF),
|
|
338
|
+
'',
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
model.pushEditOperations(
|
|
342
|
+
null,
|
|
343
|
+
[EditOperation.insert(position, eol), EditOperation.insert(position, indentContent + ',')],
|
|
344
|
+
() => null,
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
async addConfiguration(uri?: string): Promise<void> {
|
|
349
|
+
let model: DebugConfigurationModel | undefined;
|
|
350
|
+
if (uri) {
|
|
351
|
+
model = this.getModelByUri(uri);
|
|
352
|
+
} else {
|
|
353
|
+
model = this.model;
|
|
354
|
+
}
|
|
355
|
+
if (!model) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
const resouce = await this.doOpen(model);
|
|
359
|
+
if (!resouce) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
const { group } = resouce;
|
|
363
|
+
const editor = group.codeEditor.monacoEditor;
|
|
364
|
+
if (!editor) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
const position: monaco.Position | undefined = this.visitConfigurationsEditor(editor.getModel()!);
|
|
306
369
|
if (!position) {
|
|
307
370
|
return;
|
|
308
371
|
}
|
|
372
|
+
|
|
309
373
|
// 判断在"configurations": [后是否有字符,如果有则新建一行
|
|
310
374
|
if (editor.getModel()!.getLineLastNonWhitespaceColumn(position.lineNumber) > position.column) {
|
|
311
375
|
editor.setPosition(position);
|
|
@@ -40,7 +40,6 @@ import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
|
40
40
|
|
|
41
41
|
import {
|
|
42
42
|
IDebugSessionManager,
|
|
43
|
-
launchSchemaUri,
|
|
44
43
|
DEBUG_CONTAINER_ID,
|
|
45
44
|
DEBUG_WATCH_ID,
|
|
46
45
|
DEBUG_VARIABLES_ID,
|
|
@@ -53,6 +52,7 @@ import {
|
|
|
53
52
|
TSourceBrekpointProperties,
|
|
54
53
|
DEBUG_COMMANDS,
|
|
55
54
|
IDebugModelManager,
|
|
55
|
+
launchDefaultSchemaUri,
|
|
56
56
|
} from '../common';
|
|
57
57
|
|
|
58
58
|
import {
|
|
@@ -68,7 +68,7 @@ import { DebugContextKey } from './contextkeys/debug-contextkey.service';
|
|
|
68
68
|
import { DebugConfigurationManager } from './debug-configuration-manager';
|
|
69
69
|
import { DebugPreferences, debugPreferencesSchema } from './debug-preferences';
|
|
70
70
|
import { DebugProgressService } from './debug-progress.service';
|
|
71
|
-
import { launchSchema } from './debug-schema-
|
|
71
|
+
import { launchSchema } from './debug-schema-manager';
|
|
72
72
|
import { DebugSession } from './debug-session';
|
|
73
73
|
import { DebugSessionManager } from './debug-session-manager';
|
|
74
74
|
import { DebugEditorContribution } from './editor/debug-editor-contribution';
|
|
@@ -86,6 +86,10 @@ import { DebugVariableView } from './view/variables/debug-variables.view';
|
|
|
86
86
|
import { DebugWatchView } from './view/watch/debug-watch.view';
|
|
87
87
|
|
|
88
88
|
const LAUNCH_JSON_REGEX = /launch\.json$/;
|
|
89
|
+
enum LAUNCH_OPEN {
|
|
90
|
+
json,
|
|
91
|
+
editor,
|
|
92
|
+
}
|
|
89
93
|
|
|
90
94
|
export namespace DebugBreakpointWidgetCommands {
|
|
91
95
|
export const ACCEPT = {
|
|
@@ -357,7 +361,11 @@ export class DebugContribution
|
|
|
357
361
|
|
|
358
362
|
registerCommands(commands: CommandRegistry) {
|
|
359
363
|
commands.registerCommand(COMMON_COMMANDS.OPEN_LAUNCH_CONFIGURATION, {
|
|
360
|
-
execute: () => {
|
|
364
|
+
execute: (type: LAUNCH_OPEN = LAUNCH_OPEN.json) => {
|
|
365
|
+
if (type === LAUNCH_OPEN.editor) {
|
|
366
|
+
return this.debugConfigurationService.openLaunchEditor();
|
|
367
|
+
}
|
|
368
|
+
|
|
361
369
|
this.debugConfigurationService.openConfiguration();
|
|
362
370
|
},
|
|
363
371
|
});
|
|
@@ -653,7 +661,7 @@ export class DebugContribution
|
|
|
653
661
|
}
|
|
654
662
|
|
|
655
663
|
registerSchema(registry: IJSONSchemaRegistry) {
|
|
656
|
-
registry.registerSchema(
|
|
664
|
+
registry.registerSchema(launchDefaultSchemaUri, launchSchema, ['launch.json']);
|
|
657
665
|
}
|
|
658
666
|
|
|
659
667
|
registerKeybindings(keybindings: KeybindingRegistry) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Injectable, Autowired } from '@opensumi/di';
|
|
2
2
|
import { objects, IJSONSchema, IJSONSchemaRegistry } from '@opensumi/ide-core-browser';
|
|
3
3
|
|
|
4
|
-
import { launchSchemaUri } from '../common';
|
|
4
|
+
import { launchExtensionSchemaUri, launchSchemaUri } from '../common';
|
|
5
5
|
import { DebugServer, IDebugServer } from '../common/debug-service';
|
|
6
6
|
|
|
7
7
|
import { DebugConfigurationManager } from './debug-configuration-manager';
|
|
@@ -9,7 +9,7 @@ import { DebugConfigurationManager } from './debug-configuration-manager';
|
|
|
9
9
|
const { deepClone } = objects;
|
|
10
10
|
|
|
11
11
|
@Injectable()
|
|
12
|
-
export class
|
|
12
|
+
export class DebugSchemaManager {
|
|
13
13
|
@Autowired(IDebugServer)
|
|
14
14
|
protected readonly debug: DebugServer;
|
|
15
15
|
|
|
@@ -19,7 +19,7 @@ export class DebugSchemaUpdater {
|
|
|
19
19
|
@Autowired(DebugConfigurationManager)
|
|
20
20
|
private config: DebugConfigurationManager;
|
|
21
21
|
|
|
22
|
-
async update(): Promise<void> {
|
|
22
|
+
public async update(): Promise<void> {
|
|
23
23
|
const debuggers = this.config.getDebuggers();
|
|
24
24
|
const schema = { ...deepClone(launchSchema) };
|
|
25
25
|
const items = schema!.properties!.configurations.items as IJSONSchema;
|
|
@@ -38,7 +38,8 @@ export class DebugSchemaUpdater {
|
|
|
38
38
|
items.defaultSnippets.push(...configurationSnippets);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
this.schemaRegistry.registerSchema(launchExtensionSchemaUri, schema, ['launch.json']);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { strings } from '@opensumi/ide-core-browser';
|
|
2
|
+
import { SnippetParser } from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/snippet/browser/snippetParser';
|
|
2
3
|
|
|
3
4
|
import { DebugConfiguration } from '../common';
|
|
4
5
|
|
|
@@ -108,3 +109,25 @@ export class CharWidthReader {
|
|
|
108
109
|
return width;
|
|
109
110
|
}
|
|
110
111
|
}
|
|
112
|
+
|
|
113
|
+
export const parseSnippet = (value: string) => {
|
|
114
|
+
/**
|
|
115
|
+
* 在 Windows 中, 直接使用 \" 来转义双引号可能会被解析为文件路径中的反斜杠,从而导致路径错误。
|
|
116
|
+
* 为了避免这个问题,一些插件内使用 ^\" 来表示转义的双引号,这样就不会被解析为文件路径中的反斜杠了。
|
|
117
|
+
* 当调试器解析 launch.json 文件并读取字符串值时,它会将 ^" 转换为双引号。
|
|
118
|
+
* 而我们在这里为了需要把转义后的字符串能正确展示,就需要用正则去剔除
|
|
119
|
+
*/
|
|
120
|
+
const doubleQuotesRegex = new RegExp(/^\^\"(.*)\"/gm);
|
|
121
|
+
/**
|
|
122
|
+
* 使用 monaco 内部的 SnippetParser 来转换形如 ${1:xxxx} 这样的符号
|
|
123
|
+
*/
|
|
124
|
+
const snippet = new SnippetParser();
|
|
125
|
+
const isHasSnippetRegex = new RegExp(/\${\d+:(.*)/);
|
|
126
|
+
|
|
127
|
+
if (isHasSnippetRegex.test(value) || doubleQuotesRegex.test(value)) {
|
|
128
|
+
const snippetParse = snippet.text(value);
|
|
129
|
+
return snippetParse.replace(doubleQuotesRegex, '$1');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return value;
|
|
133
|
+
};
|
|
@@ -3,11 +3,12 @@ import ReactDOM from 'react-dom';
|
|
|
3
3
|
|
|
4
4
|
import { Injectable, Autowired } from '@opensumi/di';
|
|
5
5
|
import { Select, Option } from '@opensumi/ide-components';
|
|
6
|
+
import { PreferenceService } from '@opensumi/ide-core-browser';
|
|
6
7
|
import { localize, Emitter, Event } from '@opensumi/ide-core-common';
|
|
7
8
|
import { ICodeEditor } from '@opensumi/ide-editor';
|
|
8
9
|
import { ZoneWidget } from '@opensumi/ide-monaco-enhance';
|
|
9
10
|
import { ICSSStyleService } from '@opensumi/ide-theme';
|
|
10
|
-
import
|
|
11
|
+
import { EditorOption } from '@opensumi/monaco-editor-core/esm/vs/editor/common/config/editorOptions';
|
|
11
12
|
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
12
13
|
|
|
13
14
|
import {
|
|
@@ -29,6 +30,9 @@ export class DebugBreakpointZoneWidget extends ZoneWidget {
|
|
|
29
30
|
@Autowired(DebugBreakpointsService)
|
|
30
31
|
protected debugBreakpointsService: DebugBreakpointsService;
|
|
31
32
|
|
|
33
|
+
@Autowired(PreferenceService)
|
|
34
|
+
protected preferenceService: PreferenceService;
|
|
35
|
+
|
|
32
36
|
@Autowired(ICSSStyleService)
|
|
33
37
|
protected readonly cssManager: ICSSStyleService;
|
|
34
38
|
|
|
@@ -219,6 +223,17 @@ export class DebugBreakpointZoneWidget extends ZoneWidget {
|
|
|
219
223
|
this._wrapper.className = styles.debug_breakpoint_wrapper;
|
|
220
224
|
this._selection.className = styles.debug_breakpoint_selected;
|
|
221
225
|
this._input.className = styles.debug_breakpoint_input;
|
|
226
|
+
|
|
227
|
+
const model = this.editor.getModel();
|
|
228
|
+
|
|
229
|
+
if (!model) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const lineHeight = this.editor.getOption(EditorOption.lineHeight);
|
|
234
|
+
const fontSize = this.editor.getOption(EditorOption.fontSize);
|
|
235
|
+
const newTopMargin = lineHeight - fontSize;
|
|
236
|
+
this._input.style.marginTop = newTopMargin + 'px';
|
|
222
237
|
}
|
|
223
238
|
|
|
224
239
|
applyStyle() {
|
package/src/browser/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
IDebugProgress,
|
|
11
11
|
IDebugService,
|
|
12
12
|
IDebugSessionManager,
|
|
13
|
+
ILaunchService,
|
|
13
14
|
} from '../common';
|
|
14
15
|
|
|
15
16
|
import { BreakpointManager } from './breakpoint';
|
|
@@ -30,6 +31,7 @@ import { DebugHoverSource } from './editor/debug-hover-source';
|
|
|
30
31
|
import { EvaluatableExpressionServiceImpl, IEvaluatableExpressionService } from './editor/evaluatable-expression';
|
|
31
32
|
import { LaunchFolderPreferenceProvider } from './preferences/launch-folder-preference-provider';
|
|
32
33
|
import { LaunchPreferencesContribution } from './preferences/launch-preferences-contribution';
|
|
34
|
+
import { LaunchService } from './preferences/launch.service';
|
|
33
35
|
import { DebugToolbarOverlayWidget } from './view/configuration/debug-toolbar.view';
|
|
34
36
|
import { DebugConsoleModelService } from './view/console/debug-console-tree.model.service';
|
|
35
37
|
import { DebugConsoleContribution } from './view/console/debug-console.contribution';
|
|
@@ -88,6 +90,10 @@ export class DebugModule extends BrowserModule {
|
|
|
88
90
|
token: IDebugService,
|
|
89
91
|
useClass: DebugService,
|
|
90
92
|
},
|
|
93
|
+
{
|
|
94
|
+
token: ILaunchService,
|
|
95
|
+
useClass: LaunchService,
|
|
96
|
+
},
|
|
91
97
|
{
|
|
92
98
|
token: IDebugProgress,
|
|
93
99
|
useClass: DebugProgressService,
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ariaDescribedByIds,
|
|
3
|
+
descriptionId,
|
|
4
|
+
getTemplate,
|
|
5
|
+
labelValue,
|
|
6
|
+
FormContextType,
|
|
7
|
+
RJSFSchema,
|
|
8
|
+
StrictRJSFSchema,
|
|
9
|
+
WidgetProps,
|
|
10
|
+
GenericObjectType,
|
|
11
|
+
} from '@rjsf/utils';
|
|
12
|
+
import React, { FocusEvent } from 'react';
|
|
13
|
+
|
|
14
|
+
import { CheckBox } from '@opensumi/ide-components';
|
|
15
|
+
import { IJSONSchema } from '@opensumi/ide-core-common';
|
|
16
|
+
|
|
17
|
+
import styles from './json-widget.module.less';
|
|
18
|
+
|
|
19
|
+
export const CheckboxWidget = <T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
|
20
|
+
props: WidgetProps<T, S, F>,
|
|
21
|
+
) => {
|
|
22
|
+
const {
|
|
23
|
+
disabled,
|
|
24
|
+
formContext,
|
|
25
|
+
id,
|
|
26
|
+
label,
|
|
27
|
+
hideLabel,
|
|
28
|
+
onBlur,
|
|
29
|
+
onChange,
|
|
30
|
+
onFocus,
|
|
31
|
+
readonly,
|
|
32
|
+
value,
|
|
33
|
+
registry,
|
|
34
|
+
options,
|
|
35
|
+
schema,
|
|
36
|
+
uiSchema,
|
|
37
|
+
} = props;
|
|
38
|
+
const { readonlyAsDisabled = true } = formContext as GenericObjectType;
|
|
39
|
+
const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(
|
|
40
|
+
'DescriptionFieldTemplate',
|
|
41
|
+
registry,
|
|
42
|
+
options,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const handleChange = ({ target }: any) => onChange(target.checked);
|
|
46
|
+
|
|
47
|
+
const handleBlur = ({ target }: FocusEvent<HTMLInputElement>) => onBlur(id, target.checked);
|
|
48
|
+
|
|
49
|
+
const handleFocus = ({ target }: FocusEvent<HTMLInputElement>) => onFocus(id, target.checked);
|
|
50
|
+
|
|
51
|
+
const extraProps = {
|
|
52
|
+
onBlur: !readonly ? handleBlur : undefined,
|
|
53
|
+
onFocus: !readonly ? handleFocus : undefined,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const description = options.description ?? schema.description ?? (schema as IJSONSchema).markdownDescription;
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div className={styles.checkbox_widget_control}>
|
|
60
|
+
{!hideLabel && (
|
|
61
|
+
<label title={label} className={styles.field_label}>
|
|
62
|
+
{label}
|
|
63
|
+
</label>
|
|
64
|
+
)}
|
|
65
|
+
<CheckBox
|
|
66
|
+
checked={typeof value === 'undefined' ? false : value}
|
|
67
|
+
disabled={disabled || (readonlyAsDisabled && readonly)}
|
|
68
|
+
id={id}
|
|
69
|
+
name={id}
|
|
70
|
+
onChange={!readonly ? handleChange : undefined}
|
|
71
|
+
{...extraProps}
|
|
72
|
+
aria-describedby={ariaDescribedByIds<T>(id)}
|
|
73
|
+
label={description}
|
|
74
|
+
className={styles.checkbox}
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
descriptionId,
|
|
3
|
+
FieldProps,
|
|
4
|
+
FormContextType,
|
|
5
|
+
GenericObjectType,
|
|
6
|
+
getTemplate,
|
|
7
|
+
RJSFSchema,
|
|
8
|
+
StrictRJSFSchema,
|
|
9
|
+
titleId,
|
|
10
|
+
} from '@rjsf/utils';
|
|
11
|
+
import React from 'react';
|
|
12
|
+
|
|
13
|
+
import { Input } from '@opensumi/ide-components';
|
|
14
|
+
import { IJSONSchema } from '@opensumi/ide-core-common';
|
|
15
|
+
|
|
16
|
+
import styles from '../json-widget.module.less';
|
|
17
|
+
|
|
18
|
+
// 对于 anyof/oneof 的处理统一使用 input
|
|
19
|
+
export const AnyOfField = <T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
|
20
|
+
props: FieldProps<T, S, F>,
|
|
21
|
+
) => {
|
|
22
|
+
const {
|
|
23
|
+
disabled,
|
|
24
|
+
formContext,
|
|
25
|
+
idSchema,
|
|
26
|
+
onBlur,
|
|
27
|
+
id,
|
|
28
|
+
onChange,
|
|
29
|
+
onFocus,
|
|
30
|
+
options,
|
|
31
|
+
placeholder,
|
|
32
|
+
readonly,
|
|
33
|
+
registry,
|
|
34
|
+
name,
|
|
35
|
+
required,
|
|
36
|
+
schema,
|
|
37
|
+
uiOptions,
|
|
38
|
+
} = props;
|
|
39
|
+
const { readonlyAsDisabled = true } = formContext as GenericObjectType;
|
|
40
|
+
|
|
41
|
+
const handleTextChange = ({ target }: React.ChangeEvent<HTMLInputElement>) =>
|
|
42
|
+
onChange(target.value === '' ? options.emptyValue : target.value);
|
|
43
|
+
|
|
44
|
+
const handleBlur = ({ target }: React.FocusEvent<HTMLInputElement>) => onBlur(id!, target.value);
|
|
45
|
+
|
|
46
|
+
const handleFocus = ({ target }: React.FocusEvent<HTMLInputElement>) => onFocus(id!, target.value);
|
|
47
|
+
|
|
48
|
+
const description = options.description ?? schema.description ?? (schema as IJSONSchema).markdownDescription;
|
|
49
|
+
|
|
50
|
+
const TitleFieldTemplate = getTemplate<'TitleFieldTemplate', T, S, F>('TitleFieldTemplate', registry, uiOptions);
|
|
51
|
+
const DescriptionFieldTemplate = getTemplate<'DescriptionFieldTemplate', T, S, F>(
|
|
52
|
+
'DescriptionFieldTemplate',
|
|
53
|
+
registry,
|
|
54
|
+
uiOptions,
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div className={styles.any_of_widget_control}>
|
|
59
|
+
{name && (
|
|
60
|
+
<div className={styles.object_title}>
|
|
61
|
+
<TitleFieldTemplate
|
|
62
|
+
id={titleId<T>(idSchema)}
|
|
63
|
+
title={name}
|
|
64
|
+
required={required}
|
|
65
|
+
schema={schema}
|
|
66
|
+
registry={registry}
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
)}
|
|
70
|
+
{description && (
|
|
71
|
+
<div className={styles.object_description}>
|
|
72
|
+
<DescriptionFieldTemplate
|
|
73
|
+
id={descriptionId<T>(idSchema)}
|
|
74
|
+
description={description}
|
|
75
|
+
schema={schema}
|
|
76
|
+
registry={registry}
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
79
|
+
)}
|
|
80
|
+
<Input
|
|
81
|
+
disabled={disabled || (readonlyAsDisabled && readonly)}
|
|
82
|
+
onBlur={!readonly ? handleBlur : undefined}
|
|
83
|
+
onChange={!readonly ? handleTextChange : undefined}
|
|
84
|
+
onFocus={!readonly ? handleFocus : undefined}
|
|
85
|
+
placeholder={placeholder}
|
|
86
|
+
autoComplete='off'
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getDefaultRegistry } from '@rjsf/core';
|
|
2
|
+
import { FieldProps } from '@rjsf/utils';
|
|
3
|
+
import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
4
|
+
import React, { useCallback } from 'react';
|
|
5
|
+
|
|
6
|
+
import { isUndefined } from '@opensumi/ide-core-common';
|
|
7
|
+
|
|
8
|
+
const DefaultArrayField: any = getDefaultRegistry().fields.ArrayField;
|
|
9
|
+
|
|
10
|
+
export const ArrayField = <T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
|
11
|
+
props: FieldProps<T, S, F>,
|
|
12
|
+
) => {
|
|
13
|
+
const { onChange } = props;
|
|
14
|
+
|
|
15
|
+
const handleOnChange = useCallback(
|
|
16
|
+
(newFormData: T) => {
|
|
17
|
+
if (Array.isArray(newFormData)) {
|
|
18
|
+
onChange(newFormData.map((data) => (isUndefined(data) ? '' : data)) as unknown as T);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
[onChange],
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
return <DefaultArrayField {...props} onChange={handleOnChange} />;
|
|
25
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getDefaultRegistry } from '@rjsf/core';
|
|
2
|
+
import { FieldProps } from '@rjsf/utils';
|
|
3
|
+
import { FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
4
|
+
import React, { useEffect } from 'react';
|
|
5
|
+
|
|
6
|
+
import { useInjectable } from '@opensumi/ide-core-browser';
|
|
7
|
+
import { Disposable } from '@opensumi/ide-core-common';
|
|
8
|
+
|
|
9
|
+
import { ILaunchService } from '../../../../common';
|
|
10
|
+
import { LaunchService } from '../../launch.service';
|
|
11
|
+
|
|
12
|
+
const DefaultObjectField: any = getDefaultRegistry().fields.ObjectField;
|
|
13
|
+
|
|
14
|
+
export const ObjectField = <T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
|
15
|
+
props: FieldProps<T, S, F>,
|
|
16
|
+
) => {
|
|
17
|
+
const launchService = useInjectable<LaunchService>(ILaunchService);
|
|
18
|
+
const { idSchema, onChange } = props;
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const { $id } = idSchema;
|
|
22
|
+
const disabled = new Disposable();
|
|
23
|
+
|
|
24
|
+
// 仅处理 root 节点
|
|
25
|
+
if ($id === 'root') {
|
|
26
|
+
disabled.addDispose(launchService.onChangeFormData((newFormData) => onChange(newFormData as T)));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return () => disabled.dispose();
|
|
30
|
+
}, [idSchema]);
|
|
31
|
+
|
|
32
|
+
return <DefaultObjectField {...props} />;
|
|
33
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FormContextType, TitleFieldProps, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import styles from '../json-widget.module.less';
|
|
5
|
+
|
|
6
|
+
export const TitleField = <T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(
|
|
7
|
+
props: TitleFieldProps<T, S, F>,
|
|
8
|
+
) => {
|
|
9
|
+
const { title } = props;
|
|
10
|
+
|
|
11
|
+
return title ? (
|
|
12
|
+
<label title={title} className={styles.field_label}>
|
|
13
|
+
{title}
|
|
14
|
+
</label>
|
|
15
|
+
) : null;
|
|
16
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@max_width: 500px;
|
|
2
|
+
@min_width: 300px;
|
|
3
|
+
|
|
4
|
+
.select_widget_control,
|
|
5
|
+
.text_widget_control,
|
|
6
|
+
.any_of_widget_control {
|
|
7
|
+
min-width: @min_width;
|
|
8
|
+
max-width: @max_width;
|
|
9
|
+
width: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.text_widget_control {
|
|
13
|
+
input[type='number']::-webkit-outer-spin-button,
|
|
14
|
+
input[type='number']::-webkit-inner-spin-button {
|
|
15
|
+
-webkit-appearance: none;
|
|
16
|
+
margin: 0;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.checkbox_widget_control {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
|
|
24
|
+
.checkbox {
|
|
25
|
+
font-size: 14px;
|
|
26
|
+
opacity: 0.75;
|
|
27
|
+
white-space: pre-wrap;
|
|
28
|
+
color: var(--descriptionForeground);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.field_label {
|
|
33
|
+
margin-bottom: 10px;
|
|
34
|
+
font-size: 1.5em;
|
|
35
|
+
display: inline-block;
|
|
36
|
+
}
|