@theia/debug 1.26.0 → 1.27.0-next.10
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/console/debug-console-contribution.js +2 -2
- package/lib/browser/console/debug-console-contribution.js.map +1 -1
- package/lib/browser/debug-configuration-manager.d.ts +21 -5
- package/lib/browser/debug-configuration-manager.d.ts.map +1 -1
- package/lib/browser/debug-configuration-manager.js +81 -11
- package/lib/browser/debug-configuration-manager.js.map +1 -1
- package/lib/browser/debug-contribution.d.ts +0 -5
- package/lib/browser/debug-contribution.d.ts.map +1 -1
- package/lib/browser/debug-prefix-configuration.d.ts +2 -7
- package/lib/browser/debug-prefix-configuration.d.ts.map +1 -1
- package/lib/browser/debug-prefix-configuration.js +6 -13
- package/lib/browser/debug-prefix-configuration.js.map +1 -1
- package/lib/browser/debug-session-connection.d.ts +2 -3
- package/lib/browser/debug-session-connection.d.ts.map +1 -1
- package/lib/browser/debug-session-connection.js +2 -2
- package/lib/browser/debug-session-connection.js.map +1 -1
- package/lib/browser/debug-session-contribution.d.ts.map +1 -1
- package/lib/browser/debug-session-contribution.js.map +1 -1
- package/lib/browser/debug-session-options.d.ts +9 -2
- package/lib/browser/debug-session-options.d.ts.map +1 -1
- package/lib/browser/debug-session-options.js +18 -1
- package/lib/browser/debug-session-options.js.map +1 -1
- package/lib/browser/editor/debug-breakpoint-widget.js +1 -1
- package/lib/browser/editor/debug-breakpoint-widget.js.map +1 -1
- package/lib/browser/view/debug-configuration-select.d.ts +59 -0
- package/lib/browser/view/debug-configuration-select.d.ts.map +1 -0
- package/lib/browser/view/debug-configuration-select.js +183 -0
- package/lib/browser/view/debug-configuration-select.js.map +1 -0
- package/lib/browser/view/debug-configuration-widget.d.ts +5 -10
- package/lib/browser/view/debug-configuration-widget.d.ts.map +1 -1
- package/lib/browser/view/debug-configuration-widget.js +21 -54
- package/lib/browser/view/debug-configuration-widget.js.map +1 -1
- package/lib/common/debug-configuration.d.ts +0 -2
- package/lib/common/debug-configuration.d.ts.map +1 -1
- package/lib/common/debug-configuration.js.map +1 -1
- package/lib/common/debug-service.d.ts +11 -2
- package/lib/common/debug-service.d.ts.map +1 -1
- package/lib/common/debug-service.js.map +1 -1
- package/lib/node/debug-adapter-session.d.ts +1 -1
- package/lib/node/debug-adapter-session.d.ts.map +1 -1
- package/lib/node/debug-adapter-session.js +2 -2
- package/lib/node/debug-adapter-session.js.map +1 -1
- package/lib/node/debug-model.d.ts +1 -2
- package/lib/node/debug-model.d.ts.map +1 -1
- package/lib/node/debug-model.js.map +1 -1
- package/lib/node/debug-service-impl.d.ts +5 -1
- package/lib/node/debug-service-impl.d.ts.map +1 -1
- package/lib/node/debug-service-impl.js +12 -0
- package/lib/node/debug-service-impl.js.map +1 -1
- package/package.json +14 -14
- package/src/browser/console/debug-console-contribution.tsx +2 -2
- package/src/browser/debug-configuration-manager.ts +111 -16
- package/src/browser/debug-contribution.ts +0 -6
- package/src/browser/debug-prefix-configuration.ts +6 -14
- package/src/browser/debug-session-connection.ts +5 -7
- package/src/browser/debug-session-contribution.ts +2 -1
- package/src/browser/debug-session-options.ts +30 -3
- package/src/browser/editor/debug-breakpoint-widget.tsx +1 -1
- package/src/browser/view/debug-configuration-select.tsx +234 -0
- package/src/browser/view/debug-configuration-widget.tsx +24 -55
- package/src/common/debug-configuration.ts +0 -3
- package/src/common/debug-service.ts +13 -2
- package/src/node/debug-adapter-session.ts +3 -3
- package/src/node/debug-model.ts +1 -2
- package/src/node/debug-service-impl.ts +14 -3
|
@@ -214,7 +214,7 @@ export class DebugBreakpointWidget implements Disposable {
|
|
|
214
214
|
this._input.getControl().setValue(this._values[this.context] || '');
|
|
215
215
|
}
|
|
216
216
|
ReactDOM.render(<SelectComponent
|
|
217
|
-
|
|
217
|
+
defaultValue={this.context} onChange={this.updateInput}
|
|
218
218
|
options={[
|
|
219
219
|
{ value: 'condition', label: nls.localizeByDefault('Expression') },
|
|
220
220
|
{ value: 'hitCondition', label: nls.localizeByDefault('Hit Count') },
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (C) 2021 Ericsson 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
|
+
import URI from '@theia/core/lib/common/uri';
|
|
18
|
+
import * as React from '@theia/core/shared/react';
|
|
19
|
+
import { DebugConfigurationManager } from '../debug-configuration-manager';
|
|
20
|
+
import { DebugSessionOptions, InternalDebugSessionOptions } from '../debug-session-options';
|
|
21
|
+
import { SelectComponent, SelectOption } from '@theia/core/lib/browser/widgets/select-component';
|
|
22
|
+
import { QuickInputService } from '@theia/core/lib/browser';
|
|
23
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
24
|
+
|
|
25
|
+
interface DynamicPickItem { label: string, configurationType: string, request: string, providerType: string }
|
|
26
|
+
|
|
27
|
+
export interface DebugConfigurationSelectProps {
|
|
28
|
+
manager: DebugConfigurationManager,
|
|
29
|
+
quickInputService: QuickInputService,
|
|
30
|
+
isMultiRoot: boolean
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface DebugProviderSelectState {
|
|
34
|
+
providerTypes: string[],
|
|
35
|
+
currentValue: string | undefined
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class DebugConfigurationSelect extends React.Component<DebugConfigurationSelectProps, DebugProviderSelectState> {
|
|
39
|
+
protected static readonly SEPARATOR = '──────────';
|
|
40
|
+
protected static readonly PICK = '__PICK__';
|
|
41
|
+
protected static readonly NO_CONFIGURATION = '__NO_CONF__';
|
|
42
|
+
protected static readonly ADD_CONFIGURATION = '__ADD_CONF__';
|
|
43
|
+
|
|
44
|
+
private readonly selectRef = React.createRef<SelectComponent>();
|
|
45
|
+
private manager: DebugConfigurationManager;
|
|
46
|
+
private quickInputService: QuickInputService;
|
|
47
|
+
|
|
48
|
+
constructor(props: DebugConfigurationSelectProps) {
|
|
49
|
+
super(props);
|
|
50
|
+
this.manager = props.manager;
|
|
51
|
+
this.quickInputService = props.quickInputService;
|
|
52
|
+
this.state = {
|
|
53
|
+
providerTypes: [],
|
|
54
|
+
currentValue: undefined
|
|
55
|
+
};
|
|
56
|
+
this.manager.onDidChangeConfigurationProviders(() => {
|
|
57
|
+
this.refreshDebugConfigurations();
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
override componentDidMount(): void {
|
|
62
|
+
this.refreshDebugConfigurations();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
override render(): React.ReactNode {
|
|
66
|
+
return <SelectComponent
|
|
67
|
+
options={this.renderOptions()}
|
|
68
|
+
defaultValue={this.currentValue}
|
|
69
|
+
onChange={option => this.setCurrentConfiguration(option)}
|
|
70
|
+
onFocus={() => this.refreshDebugConfigurations()}
|
|
71
|
+
onBlur={() => this.refreshDebugConfigurations()}
|
|
72
|
+
ref={this.selectRef}
|
|
73
|
+
/>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
protected get currentValue(): string {
|
|
77
|
+
const { current } = this.manager;
|
|
78
|
+
return current ? InternalDebugSessionOptions.toValue(current) : DebugConfigurationSelect.NO_CONFIGURATION;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
protected readonly setCurrentConfiguration = (option: SelectOption) => {
|
|
82
|
+
const value = option.value;
|
|
83
|
+
if (!value) {
|
|
84
|
+
return false;
|
|
85
|
+
} else if (value === DebugConfigurationSelect.ADD_CONFIGURATION) {
|
|
86
|
+
this.manager.addConfiguration();
|
|
87
|
+
} else if (value.startsWith(DebugConfigurationSelect.PICK)) {
|
|
88
|
+
const providerType = this.parsePickValue(value);
|
|
89
|
+
this.selectDynamicConfigFromQuickPick(providerType);
|
|
90
|
+
} else {
|
|
91
|
+
const { name, type, request, workspaceFolderUri, providerType } = InternalDebugSessionOptions.parseValue(value);
|
|
92
|
+
this.manager.current = this.manager.find(
|
|
93
|
+
{ name, type, request },
|
|
94
|
+
workspaceFolderUri,
|
|
95
|
+
providerType === 'undefined' ? undefined : providerType
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
protected toPickValue(providerType: string): string {
|
|
101
|
+
return DebugConfigurationSelect.PICK + providerType;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
protected parsePickValue(value: string): string {
|
|
105
|
+
return value.slice(DebugConfigurationSelect.PICK.length);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
protected async resolveDynamicConfigurationPicks(providerType: string): Promise<DynamicPickItem[]> {
|
|
109
|
+
const configurationsOfProviderType =
|
|
110
|
+
(await this.manager.provideDynamicDebugConfigurations())[providerType];
|
|
111
|
+
|
|
112
|
+
if (!configurationsOfProviderType) {
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return configurationsOfProviderType.map(configuration => ({
|
|
117
|
+
label: configuration.name,
|
|
118
|
+
configurationType: configuration.type,
|
|
119
|
+
request: configuration.request,
|
|
120
|
+
providerType
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
protected async selectDynamicConfigFromQuickPick(providerType: string): Promise<void> {
|
|
125
|
+
const picks: DynamicPickItem[] = await this.resolveDynamicConfigurationPicks(providerType);
|
|
126
|
+
|
|
127
|
+
if (picks.length === 0) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const selected: DynamicPickItem | undefined = await this.quickInputService.showQuickPick(
|
|
132
|
+
picks,
|
|
133
|
+
{
|
|
134
|
+
placeholder: nls.localizeByDefault('Select Launch Configuration')
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
if (!selected) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const selectedConfiguration = {
|
|
143
|
+
name: selected.label,
|
|
144
|
+
type: selected.configurationType,
|
|
145
|
+
request: selected.request
|
|
146
|
+
};
|
|
147
|
+
this.manager.current = this.manager.find(selectedConfiguration, undefined, selected.providerType);
|
|
148
|
+
this.refreshDebugConfigurations();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
protected refreshDebugConfigurations = async () => {
|
|
152
|
+
const configsPerType = await this.manager.provideDynamicDebugConfigurations();
|
|
153
|
+
const providerTypes = [];
|
|
154
|
+
for (const [ type, configurations ] of Object.entries(configsPerType)) {
|
|
155
|
+
if (configurations.length > 0) {
|
|
156
|
+
providerTypes.push(type);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
this.selectRef.current!.value = this.currentValue;
|
|
160
|
+
this.setState({ providerTypes, currentValue: this.currentValue });
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
protected renderOptions(): SelectOption[] {
|
|
164
|
+
const options: SelectOption[] = [];
|
|
165
|
+
|
|
166
|
+
// Add non dynamic debug configurations
|
|
167
|
+
for (const config of this.manager.all) {
|
|
168
|
+
const value = InternalDebugSessionOptions.toValue(config);
|
|
169
|
+
options.push({
|
|
170
|
+
value,
|
|
171
|
+
label: this.toName(config, this.props.isMultiRoot)
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Add recently used dynamic debug configurations
|
|
176
|
+
const { recentDynamicOptions } = this.manager;
|
|
177
|
+
if (recentDynamicOptions.length > 0) {
|
|
178
|
+
if (options.length > 0) {
|
|
179
|
+
options.push({
|
|
180
|
+
separator: true
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
for (const dynamicOption of recentDynamicOptions) {
|
|
184
|
+
const value = InternalDebugSessionOptions.toValue(dynamicOption);
|
|
185
|
+
options.push({
|
|
186
|
+
value,
|
|
187
|
+
label: this.toName(dynamicOption, this.props.isMultiRoot) + ' (' + dynamicOption.providerType + ')'
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Placing a 'No Configuration' entry enables proper functioning of the 'onChange' event, by
|
|
193
|
+
// having an entry to switch from (E.g. a case where only one dynamic configuration type is available)
|
|
194
|
+
if (options.length === 0) {
|
|
195
|
+
const value = DebugConfigurationSelect.NO_CONFIGURATION;
|
|
196
|
+
options.push({
|
|
197
|
+
value,
|
|
198
|
+
label: nls.localizeByDefault('No Configurations')
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Add dynamic configuration types for quick pick selection
|
|
203
|
+
const types = this.state.providerTypes;
|
|
204
|
+
if (types.length > 0) {
|
|
205
|
+
options.push({
|
|
206
|
+
separator: true
|
|
207
|
+
});
|
|
208
|
+
for (const type of types) {
|
|
209
|
+
const value = this.toPickValue(type);
|
|
210
|
+
options.push({
|
|
211
|
+
value,
|
|
212
|
+
label: type + '...'
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
options.push({
|
|
218
|
+
separator: true
|
|
219
|
+
});
|
|
220
|
+
options.push({
|
|
221
|
+
value: DebugConfigurationSelect.ADD_CONFIGURATION,
|
|
222
|
+
label: nls.localizeByDefault('Add Configuration...')
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
return options;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
protected toName({ configuration, workspaceFolderUri }: DebugSessionOptions, multiRoot: boolean): string {
|
|
229
|
+
if (!workspaceFolderUri || !multiRoot) {
|
|
230
|
+
return configuration.name;
|
|
231
|
+
}
|
|
232
|
+
return `${configuration.name} (${new URI(workspaceFolderUri).path.base})`;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
@@ -14,20 +14,18 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
+
import { ReactWidget, QuickInputService } from '@theia/core/lib/browser';
|
|
18
|
+
import { CommandRegistry, Disposable, MessageService } from '@theia/core/lib/common';
|
|
19
|
+
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
17
20
|
import * as React from '@theia/core/shared/react';
|
|
18
|
-
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
19
|
-
import { CommandRegistry, Disposable } from '@theia/core/lib/common';
|
|
20
|
-
import { SelectComponent, SelectOption } from '@theia/core/lib/browser/widgets/select-component';
|
|
21
|
-
import URI from '@theia/core/lib/common/uri';
|
|
22
|
-
import { ReactWidget } from '@theia/core/lib/browser';
|
|
23
21
|
import { WorkspaceService } from '@theia/workspace/lib/browser';
|
|
24
22
|
import { DebugConsoleContribution } from '../console/debug-console-contribution';
|
|
25
23
|
import { DebugConfigurationManager } from '../debug-configuration-manager';
|
|
24
|
+
import { DebugCommands } from '../debug-frontend-application-contribution';
|
|
26
25
|
import { DebugSessionManager } from '../debug-session-manager';
|
|
27
26
|
import { DebugAction } from './debug-action';
|
|
27
|
+
import { DebugConfigurationSelect } from './debug-configuration-select';
|
|
28
28
|
import { DebugViewModel } from './debug-view-model';
|
|
29
|
-
import { DebugSessionOptions } from '../debug-session-options';
|
|
30
|
-
import { DebugCommands } from '../debug-frontend-application-contribution';
|
|
31
29
|
import { nls } from '@theia/core/lib/common/nls';
|
|
32
30
|
|
|
33
31
|
@injectable()
|
|
@@ -48,9 +46,15 @@ export class DebugConfigurationWidget extends ReactWidget {
|
|
|
48
46
|
@inject(DebugConsoleContribution)
|
|
49
47
|
protected readonly debugConsole: DebugConsoleContribution;
|
|
50
48
|
|
|
49
|
+
@inject(QuickInputService)
|
|
50
|
+
protected readonly quickInputService: QuickInputService;
|
|
51
|
+
|
|
51
52
|
@inject(WorkspaceService)
|
|
52
53
|
protected readonly workspaceService: WorkspaceService;
|
|
53
54
|
|
|
55
|
+
@inject(MessageService)
|
|
56
|
+
protected readonly messageService: MessageService;
|
|
57
|
+
|
|
54
58
|
@postConstruct()
|
|
55
59
|
protected init(): void {
|
|
56
60
|
this.addClass('debug-toolbar');
|
|
@@ -74,68 +78,33 @@ export class DebugConfigurationWidget extends ReactWidget {
|
|
|
74
78
|
this.stepRef.focus();
|
|
75
79
|
return true;
|
|
76
80
|
}
|
|
81
|
+
|
|
77
82
|
protected stepRef: DebugAction | undefined;
|
|
78
83
|
protected setStepRef = (stepRef: DebugAction | null) => this.stepRef = stepRef || undefined;
|
|
79
84
|
|
|
80
85
|
render(): React.ReactNode {
|
|
81
|
-
const { options } = this;
|
|
82
86
|
return <React.Fragment>
|
|
83
87
|
<DebugAction run={this.start} label={nls.localizeByDefault('Start Debugging')} iconClass='debug-start' ref={this.setStepRef} />
|
|
84
|
-
<
|
|
88
|
+
<DebugConfigurationSelect
|
|
89
|
+
manager={this.manager}
|
|
90
|
+
quickInputService={this.quickInputService}
|
|
91
|
+
isMultiRoot={this.workspaceService.isMultiRootWorkspaceOpened}
|
|
92
|
+
/>
|
|
85
93
|
<DebugAction run={this.openConfiguration} label={nls.localizeByDefault('Open {0}', '"launch.json"')}
|
|
86
94
|
iconClass='settings-gear' />
|
|
87
95
|
<DebugAction run={this.openConsole} label={nls.localizeByDefault('Debug Console')} iconClass='terminal' />
|
|
88
96
|
</React.Fragment>;
|
|
89
97
|
}
|
|
90
|
-
protected get currentValue(): string {
|
|
91
|
-
const { current } = this.manager;
|
|
92
|
-
return current ? this.toValue(current) : '__NO_CONF__';
|
|
93
|
-
}
|
|
94
|
-
protected get options(): SelectOption[] {
|
|
95
|
-
const items: SelectOption[] = Array.from(this.manager.all).map(option => ({
|
|
96
|
-
value: this.toValue(option),
|
|
97
|
-
label: this.toName(option)
|
|
98
|
-
}));
|
|
99
|
-
if (items.length === 0) {
|
|
100
|
-
items.push({
|
|
101
|
-
value: '__NO_CONF__',
|
|
102
|
-
label: nls.localizeByDefault('No Configurations')
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
items.push({
|
|
106
|
-
separator: true
|
|
107
|
-
});
|
|
108
|
-
items.push({
|
|
109
|
-
value: '__ADD_CONF__',
|
|
110
|
-
label: nls.localizeByDefault('Add Configuration...')
|
|
111
|
-
});
|
|
112
|
-
return items;
|
|
113
|
-
}
|
|
114
|
-
protected toValue({ configuration, workspaceFolderUri }: DebugSessionOptions): string {
|
|
115
|
-
if (!workspaceFolderUri) {
|
|
116
|
-
return configuration.name;
|
|
117
|
-
}
|
|
118
|
-
return configuration.name + '__CONF__' + workspaceFolderUri;
|
|
119
|
-
}
|
|
120
|
-
protected toName({ configuration, workspaceFolderUri }: DebugSessionOptions): string {
|
|
121
|
-
if (!workspaceFolderUri || !this.workspaceService.isMultiRootWorkspaceOpened) {
|
|
122
|
-
return configuration.name;
|
|
123
|
-
}
|
|
124
|
-
return configuration.name + ' (' + new URI(workspaceFolderUri).path.base + ')';
|
|
125
|
-
}
|
|
126
98
|
|
|
127
|
-
protected readonly
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
this.manager.
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
99
|
+
protected readonly start = async () => {
|
|
100
|
+
let configuration;
|
|
101
|
+
try {
|
|
102
|
+
configuration = await this.manager.getSelectedConfiguration();
|
|
103
|
+
} catch (e) {
|
|
104
|
+
this.messageService.error(e.message);
|
|
105
|
+
return;
|
|
134
106
|
}
|
|
135
|
-
};
|
|
136
107
|
|
|
137
|
-
protected readonly start = () => {
|
|
138
|
-
const configuration = this.manager.current;
|
|
139
108
|
this.commandRegistry.executeCommand(DebugCommands.START.id, configuration);
|
|
140
109
|
};
|
|
141
110
|
|
|
@@ -74,9 +74,6 @@ export interface DebugConfiguration {
|
|
|
74
74
|
|
|
75
75
|
/** Task to run after debug session ends */
|
|
76
76
|
postDebugTask?: string | TaskIdentifier;
|
|
77
|
-
|
|
78
|
-
/** Indicates if it's a dynamic debug configuration */
|
|
79
|
-
dynamic?: boolean;
|
|
80
77
|
}
|
|
81
78
|
export namespace DebugConfiguration {
|
|
82
79
|
export function is(arg: DebugConfiguration | any): arg is DebugConfiguration {
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
|
|
17
17
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
18
|
|
|
19
|
-
import { Disposable } from '@theia/core';
|
|
19
|
+
import { Disposable, Event } from '@theia/core';
|
|
20
20
|
import { ApplicationError } from '@theia/core/lib/common/application-error';
|
|
21
21
|
import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema';
|
|
22
|
-
import { CommandIdVariables } from '@theia/variable-resolver/lib/
|
|
22
|
+
import { CommandIdVariables } from '@theia/variable-resolver/lib/common/variable-types';
|
|
23
23
|
import { DebugConfiguration } from './debug-configuration';
|
|
24
24
|
|
|
25
25
|
export interface DebuggerDescription {
|
|
@@ -82,6 +82,11 @@ export interface DebugService extends Disposable {
|
|
|
82
82
|
*/
|
|
83
83
|
provideDynamicDebugConfigurations?(): Promise<Record<string, DebugConfiguration[]>>;
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Provides a dynamic debug configuration matching the name and the provider debug type
|
|
87
|
+
*/
|
|
88
|
+
fetchDynamicDebugConfiguration(name: string, type: string): Promise<DebugConfiguration | undefined>;
|
|
89
|
+
|
|
85
90
|
/**
|
|
86
91
|
* Resolves a [debug configuration](#DebugConfiguration) by filling in missing values
|
|
87
92
|
* or by adding/changing/removing attributes before variable substitution.
|
|
@@ -116,6 +121,12 @@ export interface DebugService extends Disposable {
|
|
|
116
121
|
* Stop a running session for the given session id.
|
|
117
122
|
*/
|
|
118
123
|
terminateDebugSession(sessionId: string): Promise<void>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Event handle to indicate when one or more dynamic debug configuration providers
|
|
127
|
+
* have been registered or unregistered.
|
|
128
|
+
*/
|
|
129
|
+
onDidChangeDebugConfigurationProviders: Event<void>;
|
|
119
130
|
}
|
|
120
131
|
|
|
121
132
|
/**
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
DebugAdapterSession
|
|
27
27
|
} from './debug-model';
|
|
28
28
|
import { DebugProtocol } from 'vscode-debugprotocol';
|
|
29
|
-
import { Channel } from '
|
|
29
|
+
import { Channel } from '@theia/core';
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* [DebugAdapterSession](#DebugAdapterSession) implementation.
|
|
@@ -53,7 +53,7 @@ export class DebugAdapterSessionImpl implements DebugAdapterSession {
|
|
|
53
53
|
throw new Error('The session has already been started, id: ' + this.id);
|
|
54
54
|
}
|
|
55
55
|
this.channel = channel;
|
|
56
|
-
this.channel.onMessage(
|
|
56
|
+
this.channel.onMessage(message => this.write(message().readString()));
|
|
57
57
|
this.channel.onClose(() => this.channel = undefined);
|
|
58
58
|
|
|
59
59
|
}
|
|
@@ -80,7 +80,7 @@ export class DebugAdapterSessionImpl implements DebugAdapterSession {
|
|
|
80
80
|
|
|
81
81
|
protected send(message: string): void {
|
|
82
82
|
if (this.channel) {
|
|
83
|
-
this.channel.
|
|
83
|
+
this.channel.getWriteBuffer().writeString(message);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
package/src/node/debug-model.ts
CHANGED
|
@@ -25,8 +25,7 @@
|
|
|
25
25
|
import { DebugConfiguration } from '../common/debug-configuration';
|
|
26
26
|
import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema';
|
|
27
27
|
import { MaybePromise } from '@theia/core/lib/common/types';
|
|
28
|
-
import { Event } from '@theia/core
|
|
29
|
-
import { Channel } from '../common/debug-service';
|
|
28
|
+
import { Channel, Event } from '@theia/core';
|
|
30
29
|
|
|
31
30
|
// FIXME: break down this file to debug adapter and debug adapter contribution (see Theia file naming conventions)
|
|
32
31
|
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
18
18
|
import { DebugConfiguration } from '../common/debug-configuration';
|
|
19
19
|
import { DebugService, DebuggerDescription } from '../common/debug-service';
|
|
20
|
-
|
|
21
20
|
import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema';
|
|
22
|
-
import { CommandIdVariables } from '@theia/variable-resolver/lib/
|
|
21
|
+
import { CommandIdVariables } from '@theia/variable-resolver/lib/common/variable-types';
|
|
23
22
|
import { DebugAdapterSessionManager } from './debug-adapter-session-manager';
|
|
24
23
|
import { DebugAdapterContributionRegistry } from './debug-adapter-contribution-registry';
|
|
24
|
+
import { Event } from '@theia/core';
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* DebugService implementation.
|
|
@@ -35,6 +35,10 @@ export class DebugServiceImpl implements DebugService {
|
|
|
35
35
|
@inject(DebugAdapterContributionRegistry)
|
|
36
36
|
protected readonly registry: DebugAdapterContributionRegistry;
|
|
37
37
|
|
|
38
|
+
get onDidChangeDebugConfigurationProviders(): Event<void> {
|
|
39
|
+
return Event.None;
|
|
40
|
+
}
|
|
41
|
+
|
|
38
42
|
dispose(): void {
|
|
39
43
|
this.terminateDebugSession();
|
|
40
44
|
}
|
|
@@ -63,6 +67,14 @@ export class DebugServiceImpl implements DebugService {
|
|
|
63
67
|
async provideDebugConfigurations(debugType: string, workspaceFolderUri?: string): Promise<DebugConfiguration[]> {
|
|
64
68
|
return this.registry.provideDebugConfigurations(debugType, workspaceFolderUri);
|
|
65
69
|
}
|
|
70
|
+
async provideDynamicDebugConfigurations(): Promise<Record<string, DebugConfiguration[]>> {
|
|
71
|
+
// TODO: Support dynamic debug configurations through Theia extensions?
|
|
72
|
+
return {};
|
|
73
|
+
}
|
|
74
|
+
fetchDynamicDebugConfiguration(name: string, type: string): Promise<DebugConfiguration | undefined> {
|
|
75
|
+
// TODO: Support dynamic debug configurations through Theia extensions?
|
|
76
|
+
return Promise.resolve(undefined);
|
|
77
|
+
}
|
|
66
78
|
async resolveDebugConfiguration(config: DebugConfiguration, workspaceFolderUri?: string): Promise<DebugConfiguration> {
|
|
67
79
|
return this.registry.resolveDebugConfiguration(config, workspaceFolderUri);
|
|
68
80
|
}
|
|
@@ -104,5 +116,4 @@ export class DebugServiceImpl implements DebugService {
|
|
|
104
116
|
await debugSession.stop();
|
|
105
117
|
}
|
|
106
118
|
}
|
|
107
|
-
|
|
108
119
|
}
|