@theia/debug 1.53.0-next.55 → 1.53.0-next.64
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/README.md +62 -62
- package/lib/browser/debug-configuration-manager.js +6 -6
- package/lib/common/inline-debug-adapter.d.ts +0 -1
- package/lib/common/inline-debug-adapter.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/browser/breakpoint/breakpoint-manager.ts +369 -369
- package/src/browser/breakpoint/breakpoint-marker.ts +104 -104
- package/src/browser/console/debug-console-contribution.tsx +240 -240
- package/src/browser/console/debug-console-items.tsx +384 -384
- package/src/browser/console/debug-console-session.ts +205 -205
- package/src/browser/debug-call-stack-item-type-key.ts +20 -20
- package/src/browser/debug-configuration-manager.ts +591 -591
- package/src/browser/debug-configuration-model.ts +100 -100
- package/src/browser/debug-contribution.ts +43 -43
- package/src/browser/debug-frontend-application-contribution.ts +1551 -1551
- package/src/browser/debug-frontend-module.ts +133 -133
- package/src/browser/debug-package.spec.ts +20 -20
- package/src/browser/debug-preferences.ts +98 -98
- package/src/browser/debug-prefix-configuration.ts +195 -195
- package/src/browser/debug-resource.ts +59 -59
- package/src/browser/debug-schema-updater.ts +149 -149
- package/src/browser/debug-session-connection.ts +357 -357
- package/src/browser/debug-session-contribution.ts +157 -157
- package/src/browser/debug-session-manager.ts +683 -683
- package/src/browser/debug-session-options.ts +120 -120
- package/src/browser/debug-session.tsx +974 -974
- package/src/browser/debug-tab-bar-decorator.ts +57 -57
- package/src/browser/debug-watch-manager.ts +93 -93
- package/src/browser/disassembly-view/disassembly-view-accessibility-provider.ts +43 -43
- package/src/browser/disassembly-view/disassembly-view-breakpoint-renderer.ts +119 -119
- package/src/browser/disassembly-view/disassembly-view-contribution.ts +109 -109
- package/src/browser/disassembly-view/disassembly-view-instruction-renderer.ts +245 -245
- package/src/browser/disassembly-view/disassembly-view-table-delegate.ts +39 -39
- package/src/browser/disassembly-view/disassembly-view-utilities.ts +55 -55
- package/src/browser/disassembly-view/disassembly-view-widget.ts +463 -463
- package/src/browser/editor/debug-breakpoint-widget.tsx +293 -293
- package/src/browser/editor/debug-editor-model.ts +529 -529
- package/src/browser/editor/debug-editor-service.ts +192 -192
- package/src/browser/editor/debug-editor.ts +20 -20
- package/src/browser/editor/debug-exception-widget.tsx +122 -122
- package/src/browser/editor/debug-expression-provider.ts +78 -78
- package/src/browser/editor/debug-hover-source.tsx +105 -105
- package/src/browser/editor/debug-hover-widget.ts +298 -298
- package/src/browser/editor/debug-inline-value-decorator.ts +373 -373
- package/src/browser/model/debug-breakpoint.tsx +151 -151
- package/src/browser/model/debug-function-breakpoint.tsx +101 -101
- package/src/browser/model/debug-instruction-breakpoint.tsx +68 -68
- package/src/browser/model/debug-source-breakpoint.tsx +237 -237
- package/src/browser/model/debug-source.ts +93 -93
- package/src/browser/model/debug-stack-frame.tsx +177 -177
- package/src/browser/model/debug-thread.tsx +292 -292
- package/src/browser/preferences/launch-preferences.ts +38 -38
- package/src/browser/style/index.css +453 -453
- package/src/browser/view/debug-action.tsx +57 -57
- package/src/browser/view/debug-breakpoints-source.tsx +53 -53
- package/src/browser/view/debug-breakpoints-widget.ts +71 -71
- package/src/browser/view/debug-configuration-select.tsx +269 -269
- package/src/browser/view/debug-configuration-widget.tsx +121 -121
- package/src/browser/view/debug-exception-breakpoint.tsx +68 -68
- package/src/browser/view/debug-session-widget.ts +124 -124
- package/src/browser/view/debug-stack-frames-source.tsx +75 -75
- package/src/browser/view/debug-stack-frames-widget.ts +135 -135
- package/src/browser/view/debug-threads-source.tsx +48 -48
- package/src/browser/view/debug-threads-widget.ts +126 -126
- package/src/browser/view/debug-toolbar-widget.tsx +145 -145
- package/src/browser/view/debug-variables-source.ts +43 -43
- package/src/browser/view/debug-variables-widget.ts +61 -61
- package/src/browser/view/debug-view-model.ts +230 -230
- package/src/browser/view/debug-watch-expression.tsx +88 -88
- package/src/browser/view/debug-watch-source.ts +41 -41
- package/src/browser/view/debug-watch-widget.ts +61 -61
- package/src/browser/view/debug-widget.ts +97 -97
- package/src/common/debug-adapter-contribution-registry.ts +206 -206
- package/src/common/debug-adapter-session.ts +102 -102
- package/src/common/debug-common.ts +19 -19
- package/src/common/debug-compound.ts +33 -33
- package/src/common/debug-configuration.ts +112 -112
- package/src/common/debug-model.ts +200 -200
- package/src/common/debug-service.ts +184 -184
- package/src/common/debug-uri-utils.ts +24 -24
- package/src/common/inline-debug-adapter.ts +47 -47
- package/src/node/debug-adapter-factory.ts +107 -107
- package/src/node/debug-adapter-session-manager.ts +106 -106
- package/src/node/debug-backend-module.ts +57 -57
- package/src/node/debug-service-impl.ts +119 -119
- package/src/node/stream-debug-adapter.ts +126 -126
|
@@ -1,205 +1,205 @@
|
|
|
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-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import throttle = require('@theia/core/shared/lodash.throttle');
|
|
18
|
-
import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
|
|
19
|
-
import { ConsoleSession, ConsoleItem } from '@theia/console/lib/browser/console-session';
|
|
20
|
-
import { AnsiConsoleItem } from '@theia/console/lib/browser/ansi-console-item';
|
|
21
|
-
import { DebugSession } from '../debug-session';
|
|
22
|
-
import URI from '@theia/core/lib/common/uri';
|
|
23
|
-
import { ExpressionContainer, ExpressionItem } from './debug-console-items';
|
|
24
|
-
import { Severity } from '@theia/core/lib/common/severity';
|
|
25
|
-
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
26
|
-
import { DebugSessionManager } from '../debug-session-manager';
|
|
27
|
-
import * as monaco from '@theia/monaco-editor-core';
|
|
28
|
-
import { LanguageSelector } from '@theia/monaco-editor-core/esm/vs/editor/common/languageSelector';
|
|
29
|
-
import { Disposable } from '@theia/core';
|
|
30
|
-
|
|
31
|
-
export const DebugConsoleSessionFactory = Symbol('DebugConsoleSessionFactory');
|
|
32
|
-
|
|
33
|
-
export type DebugConsoleSessionFactory = (debugSession: DebugSession) => DebugConsoleSession;
|
|
34
|
-
|
|
35
|
-
@injectable()
|
|
36
|
-
export class DebugConsoleSession extends ConsoleSession {
|
|
37
|
-
|
|
38
|
-
static uri = new URI().withScheme('debugconsole');
|
|
39
|
-
|
|
40
|
-
@inject(DebugSessionManager) protected readonly sessionManager: DebugSessionManager;
|
|
41
|
-
|
|
42
|
-
protected items: ConsoleItem[] = [];
|
|
43
|
-
|
|
44
|
-
protected _debugSession: DebugSession;
|
|
45
|
-
|
|
46
|
-
// content buffer for [append](#append) method
|
|
47
|
-
protected uncompletedItemContent: string | undefined;
|
|
48
|
-
|
|
49
|
-
protected readonly completionKinds = new Map<DebugProtocol.CompletionItemType | undefined, monaco.languages.CompletionItemKind>();
|
|
50
|
-
|
|
51
|
-
get debugSession(): DebugSession {
|
|
52
|
-
return this._debugSession;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
set debugSession(value: DebugSession) {
|
|
56
|
-
this._debugSession = value;
|
|
57
|
-
this.id = value.id;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@postConstruct()
|
|
61
|
-
init(): void {
|
|
62
|
-
this.completionKinds.set('method', monaco.languages.CompletionItemKind.Method);
|
|
63
|
-
this.completionKinds.set('function', monaco.languages.CompletionItemKind.Function);
|
|
64
|
-
this.completionKinds.set('constructor', monaco.languages.CompletionItemKind.Constructor);
|
|
65
|
-
this.completionKinds.set('field', monaco.languages.CompletionItemKind.Field);
|
|
66
|
-
this.completionKinds.set('variable', monaco.languages.CompletionItemKind.Variable);
|
|
67
|
-
this.completionKinds.set('class', monaco.languages.CompletionItemKind.Class);
|
|
68
|
-
this.completionKinds.set('interface', monaco.languages.CompletionItemKind.Interface);
|
|
69
|
-
this.completionKinds.set('module', monaco.languages.CompletionItemKind.Module);
|
|
70
|
-
this.completionKinds.set('property', monaco.languages.CompletionItemKind.Property);
|
|
71
|
-
this.completionKinds.set('unit', monaco.languages.CompletionItemKind.Unit);
|
|
72
|
-
this.completionKinds.set('value', monaco.languages.CompletionItemKind.Value);
|
|
73
|
-
this.completionKinds.set('enum', monaco.languages.CompletionItemKind.Enum);
|
|
74
|
-
this.completionKinds.set('keyword', monaco.languages.CompletionItemKind.Keyword);
|
|
75
|
-
this.completionKinds.set('snippet', monaco.languages.CompletionItemKind.Snippet);
|
|
76
|
-
this.completionKinds.set('text', monaco.languages.CompletionItemKind.Text);
|
|
77
|
-
this.completionKinds.set('color', monaco.languages.CompletionItemKind.Color);
|
|
78
|
-
this.completionKinds.set('file', monaco.languages.CompletionItemKind.File);
|
|
79
|
-
this.completionKinds.set('reference', monaco.languages.CompletionItemKind.Reference);
|
|
80
|
-
this.completionKinds.set('customcolor', monaco.languages.CompletionItemKind.Color);
|
|
81
|
-
this.toDispose.push((monaco.languages.registerCompletionItemProvider as (languageId: LanguageSelector, provider: monaco.languages.CompletionItemProvider) => Disposable)({
|
|
82
|
-
scheme: DebugConsoleSession.uri.scheme,
|
|
83
|
-
hasAccessToAllModels: true
|
|
84
|
-
}, {
|
|
85
|
-
triggerCharacters: ['.'],
|
|
86
|
-
provideCompletionItems: (model, position) => this.completions(model, position),
|
|
87
|
-
}));
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
getElements(): IterableIterator<ConsoleItem> {
|
|
91
|
-
return this.items.filter(e => !this.severity || e.severity === this.severity)[Symbol.iterator]();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
protected async completions(model: monaco.editor.ITextModel, position: monaco.Position): Promise<monaco.languages.CompletionList | undefined> {
|
|
95
|
-
const completionSession = this.findCompletionSession();
|
|
96
|
-
if (completionSession) {
|
|
97
|
-
const column = position.column;
|
|
98
|
-
const lineNumber = position.lineNumber;
|
|
99
|
-
const word = model.getWordAtPosition({ column, lineNumber });
|
|
100
|
-
const overwriteBefore = word ? word.word.length : 0;
|
|
101
|
-
const text = model.getValue();
|
|
102
|
-
const items = await completionSession.completions(text, column, lineNumber);
|
|
103
|
-
const suggestions = items.map(item => this.asCompletionItem(text, position, overwriteBefore, item));
|
|
104
|
-
return { suggestions };
|
|
105
|
-
}
|
|
106
|
-
return undefined;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
protected findCurrentSession(): DebugSession | undefined {
|
|
110
|
-
const currentSession = this.sessionManager.currentSession;
|
|
111
|
-
if (!currentSession) {
|
|
112
|
-
return undefined;
|
|
113
|
-
}
|
|
114
|
-
if (currentSession.id === this.debugSession.id) {
|
|
115
|
-
// perfect match
|
|
116
|
-
return this.debugSession;
|
|
117
|
-
}
|
|
118
|
-
const parentSession = currentSession.findConsoleParent();
|
|
119
|
-
if (parentSession?.id === this.debugSession.id) {
|
|
120
|
-
// child of our session
|
|
121
|
-
return currentSession;
|
|
122
|
-
}
|
|
123
|
-
return undefined;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
protected findCompletionSession(): DebugSession | undefined {
|
|
127
|
-
let completionSession: DebugSession | undefined = this.findCurrentSession();
|
|
128
|
-
while (completionSession !== undefined) {
|
|
129
|
-
if (completionSession.capabilities.supportsCompletionsRequest) {
|
|
130
|
-
return completionSession;
|
|
131
|
-
}
|
|
132
|
-
completionSession = completionSession.parentSession;
|
|
133
|
-
}
|
|
134
|
-
return completionSession;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
protected asCompletionItem(text: string, position: monaco.Position, overwriteBefore: number, item: DebugProtocol.CompletionItem): monaco.languages.CompletionItem {
|
|
138
|
-
return {
|
|
139
|
-
label: item.label,
|
|
140
|
-
insertText: item.text || item.label,
|
|
141
|
-
kind: this.completionKinds.get(item.type) || monaco.languages.CompletionItemKind.Property,
|
|
142
|
-
filterText: (item.start && item.length) ? text.substring(item.start, item.start + item.length).concat(item.label) : undefined,
|
|
143
|
-
range: monaco.Range.fromPositions(position.delta(0, -(item.length || overwriteBefore)), position),
|
|
144
|
-
sortText: item.sortText
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
async execute(value: string): Promise<void> {
|
|
149
|
-
const expression = new ExpressionItem(value, () => this.findCurrentSession());
|
|
150
|
-
this.items.push(expression);
|
|
151
|
-
await expression.evaluate();
|
|
152
|
-
this.fireDidChange();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
clear(): void {
|
|
156
|
-
this.items = [];
|
|
157
|
-
this.fireDidChange();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
append(value: string): void {
|
|
161
|
-
if (!value) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const lastItem = this.items.slice(-1)[0];
|
|
166
|
-
if (lastItem instanceof AnsiConsoleItem && lastItem.content === this.uncompletedItemContent) {
|
|
167
|
-
this.items.pop();
|
|
168
|
-
this.uncompletedItemContent += value;
|
|
169
|
-
} else {
|
|
170
|
-
this.uncompletedItemContent = value;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
this.items.push(new AnsiConsoleItem(this.uncompletedItemContent, Severity.Info));
|
|
174
|
-
this.fireDidChange();
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
appendLine(value: string): void {
|
|
178
|
-
this.items.push(new AnsiConsoleItem(value, Severity.Info));
|
|
179
|
-
this.fireDidChange();
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
async logOutput(session: DebugSession, event: DebugProtocol.OutputEvent): Promise<void> {
|
|
183
|
-
const body = event.body;
|
|
184
|
-
const { category, variablesReference } = body;
|
|
185
|
-
if (category === 'telemetry') {
|
|
186
|
-
console.debug(`telemetry/${event.body.output}`, event.body.data);
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
const severity = category === 'stderr' ? Severity.Error : event.body.category === 'console' ? Severity.Warning : Severity.Info;
|
|
190
|
-
if (variablesReference) {
|
|
191
|
-
const items = await new ExpressionContainer({ session: () => session, variablesReference }).getElements();
|
|
192
|
-
for (const item of items) {
|
|
193
|
-
this.items.push(Object.assign(item, { severity }));
|
|
194
|
-
}
|
|
195
|
-
} else if (typeof body.output === 'string') {
|
|
196
|
-
for (const line of body.output.split('\n')) {
|
|
197
|
-
this.items.push(new AnsiConsoleItem(line, severity));
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
this.fireDidChange();
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
protected override fireDidChange = throttle(() => super.fireDidChange(), 50);
|
|
204
|
-
|
|
205
|
-
}
|
|
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-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import throttle = require('@theia/core/shared/lodash.throttle');
|
|
18
|
+
import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
|
|
19
|
+
import { ConsoleSession, ConsoleItem } from '@theia/console/lib/browser/console-session';
|
|
20
|
+
import { AnsiConsoleItem } from '@theia/console/lib/browser/ansi-console-item';
|
|
21
|
+
import { DebugSession } from '../debug-session';
|
|
22
|
+
import URI from '@theia/core/lib/common/uri';
|
|
23
|
+
import { ExpressionContainer, ExpressionItem } from './debug-console-items';
|
|
24
|
+
import { Severity } from '@theia/core/lib/common/severity';
|
|
25
|
+
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
26
|
+
import { DebugSessionManager } from '../debug-session-manager';
|
|
27
|
+
import * as monaco from '@theia/monaco-editor-core';
|
|
28
|
+
import { LanguageSelector } from '@theia/monaco-editor-core/esm/vs/editor/common/languageSelector';
|
|
29
|
+
import { Disposable } from '@theia/core';
|
|
30
|
+
|
|
31
|
+
export const DebugConsoleSessionFactory = Symbol('DebugConsoleSessionFactory');
|
|
32
|
+
|
|
33
|
+
export type DebugConsoleSessionFactory = (debugSession: DebugSession) => DebugConsoleSession;
|
|
34
|
+
|
|
35
|
+
@injectable()
|
|
36
|
+
export class DebugConsoleSession extends ConsoleSession {
|
|
37
|
+
|
|
38
|
+
static uri = new URI().withScheme('debugconsole');
|
|
39
|
+
|
|
40
|
+
@inject(DebugSessionManager) protected readonly sessionManager: DebugSessionManager;
|
|
41
|
+
|
|
42
|
+
protected items: ConsoleItem[] = [];
|
|
43
|
+
|
|
44
|
+
protected _debugSession: DebugSession;
|
|
45
|
+
|
|
46
|
+
// content buffer for [append](#append) method
|
|
47
|
+
protected uncompletedItemContent: string | undefined;
|
|
48
|
+
|
|
49
|
+
protected readonly completionKinds = new Map<DebugProtocol.CompletionItemType | undefined, monaco.languages.CompletionItemKind>();
|
|
50
|
+
|
|
51
|
+
get debugSession(): DebugSession {
|
|
52
|
+
return this._debugSession;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
set debugSession(value: DebugSession) {
|
|
56
|
+
this._debugSession = value;
|
|
57
|
+
this.id = value.id;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@postConstruct()
|
|
61
|
+
init(): void {
|
|
62
|
+
this.completionKinds.set('method', monaco.languages.CompletionItemKind.Method);
|
|
63
|
+
this.completionKinds.set('function', monaco.languages.CompletionItemKind.Function);
|
|
64
|
+
this.completionKinds.set('constructor', monaco.languages.CompletionItemKind.Constructor);
|
|
65
|
+
this.completionKinds.set('field', monaco.languages.CompletionItemKind.Field);
|
|
66
|
+
this.completionKinds.set('variable', monaco.languages.CompletionItemKind.Variable);
|
|
67
|
+
this.completionKinds.set('class', monaco.languages.CompletionItemKind.Class);
|
|
68
|
+
this.completionKinds.set('interface', monaco.languages.CompletionItemKind.Interface);
|
|
69
|
+
this.completionKinds.set('module', monaco.languages.CompletionItemKind.Module);
|
|
70
|
+
this.completionKinds.set('property', monaco.languages.CompletionItemKind.Property);
|
|
71
|
+
this.completionKinds.set('unit', monaco.languages.CompletionItemKind.Unit);
|
|
72
|
+
this.completionKinds.set('value', monaco.languages.CompletionItemKind.Value);
|
|
73
|
+
this.completionKinds.set('enum', monaco.languages.CompletionItemKind.Enum);
|
|
74
|
+
this.completionKinds.set('keyword', monaco.languages.CompletionItemKind.Keyword);
|
|
75
|
+
this.completionKinds.set('snippet', monaco.languages.CompletionItemKind.Snippet);
|
|
76
|
+
this.completionKinds.set('text', monaco.languages.CompletionItemKind.Text);
|
|
77
|
+
this.completionKinds.set('color', monaco.languages.CompletionItemKind.Color);
|
|
78
|
+
this.completionKinds.set('file', monaco.languages.CompletionItemKind.File);
|
|
79
|
+
this.completionKinds.set('reference', monaco.languages.CompletionItemKind.Reference);
|
|
80
|
+
this.completionKinds.set('customcolor', monaco.languages.CompletionItemKind.Color);
|
|
81
|
+
this.toDispose.push((monaco.languages.registerCompletionItemProvider as (languageId: LanguageSelector, provider: monaco.languages.CompletionItemProvider) => Disposable)({
|
|
82
|
+
scheme: DebugConsoleSession.uri.scheme,
|
|
83
|
+
hasAccessToAllModels: true
|
|
84
|
+
}, {
|
|
85
|
+
triggerCharacters: ['.'],
|
|
86
|
+
provideCompletionItems: (model, position) => this.completions(model, position),
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
getElements(): IterableIterator<ConsoleItem> {
|
|
91
|
+
return this.items.filter(e => !this.severity || e.severity === this.severity)[Symbol.iterator]();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
protected async completions(model: monaco.editor.ITextModel, position: monaco.Position): Promise<monaco.languages.CompletionList | undefined> {
|
|
95
|
+
const completionSession = this.findCompletionSession();
|
|
96
|
+
if (completionSession) {
|
|
97
|
+
const column = position.column;
|
|
98
|
+
const lineNumber = position.lineNumber;
|
|
99
|
+
const word = model.getWordAtPosition({ column, lineNumber });
|
|
100
|
+
const overwriteBefore = word ? word.word.length : 0;
|
|
101
|
+
const text = model.getValue();
|
|
102
|
+
const items = await completionSession.completions(text, column, lineNumber);
|
|
103
|
+
const suggestions = items.map(item => this.asCompletionItem(text, position, overwriteBefore, item));
|
|
104
|
+
return { suggestions };
|
|
105
|
+
}
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
protected findCurrentSession(): DebugSession | undefined {
|
|
110
|
+
const currentSession = this.sessionManager.currentSession;
|
|
111
|
+
if (!currentSession) {
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
if (currentSession.id === this.debugSession.id) {
|
|
115
|
+
// perfect match
|
|
116
|
+
return this.debugSession;
|
|
117
|
+
}
|
|
118
|
+
const parentSession = currentSession.findConsoleParent();
|
|
119
|
+
if (parentSession?.id === this.debugSession.id) {
|
|
120
|
+
// child of our session
|
|
121
|
+
return currentSession;
|
|
122
|
+
}
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
protected findCompletionSession(): DebugSession | undefined {
|
|
127
|
+
let completionSession: DebugSession | undefined = this.findCurrentSession();
|
|
128
|
+
while (completionSession !== undefined) {
|
|
129
|
+
if (completionSession.capabilities.supportsCompletionsRequest) {
|
|
130
|
+
return completionSession;
|
|
131
|
+
}
|
|
132
|
+
completionSession = completionSession.parentSession;
|
|
133
|
+
}
|
|
134
|
+
return completionSession;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
protected asCompletionItem(text: string, position: monaco.Position, overwriteBefore: number, item: DebugProtocol.CompletionItem): monaco.languages.CompletionItem {
|
|
138
|
+
return {
|
|
139
|
+
label: item.label,
|
|
140
|
+
insertText: item.text || item.label,
|
|
141
|
+
kind: this.completionKinds.get(item.type) || monaco.languages.CompletionItemKind.Property,
|
|
142
|
+
filterText: (item.start && item.length) ? text.substring(item.start, item.start + item.length).concat(item.label) : undefined,
|
|
143
|
+
range: monaco.Range.fromPositions(position.delta(0, -(item.length || overwriteBefore)), position),
|
|
144
|
+
sortText: item.sortText
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
async execute(value: string): Promise<void> {
|
|
149
|
+
const expression = new ExpressionItem(value, () => this.findCurrentSession());
|
|
150
|
+
this.items.push(expression);
|
|
151
|
+
await expression.evaluate();
|
|
152
|
+
this.fireDidChange();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
clear(): void {
|
|
156
|
+
this.items = [];
|
|
157
|
+
this.fireDidChange();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
append(value: string): void {
|
|
161
|
+
if (!value) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const lastItem = this.items.slice(-1)[0];
|
|
166
|
+
if (lastItem instanceof AnsiConsoleItem && lastItem.content === this.uncompletedItemContent) {
|
|
167
|
+
this.items.pop();
|
|
168
|
+
this.uncompletedItemContent += value;
|
|
169
|
+
} else {
|
|
170
|
+
this.uncompletedItemContent = value;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
this.items.push(new AnsiConsoleItem(this.uncompletedItemContent, Severity.Info));
|
|
174
|
+
this.fireDidChange();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
appendLine(value: string): void {
|
|
178
|
+
this.items.push(new AnsiConsoleItem(value, Severity.Info));
|
|
179
|
+
this.fireDidChange();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
async logOutput(session: DebugSession, event: DebugProtocol.OutputEvent): Promise<void> {
|
|
183
|
+
const body = event.body;
|
|
184
|
+
const { category, variablesReference } = body;
|
|
185
|
+
if (category === 'telemetry') {
|
|
186
|
+
console.debug(`telemetry/${event.body.output}`, event.body.data);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const severity = category === 'stderr' ? Severity.Error : event.body.category === 'console' ? Severity.Warning : Severity.Info;
|
|
190
|
+
if (variablesReference) {
|
|
191
|
+
const items = await new ExpressionContainer({ session: () => session, variablesReference }).getElements();
|
|
192
|
+
for (const item of items) {
|
|
193
|
+
this.items.push(Object.assign(item, { severity }));
|
|
194
|
+
}
|
|
195
|
+
} else if (typeof body.output === 'string') {
|
|
196
|
+
for (const line of body.output.split('\n')) {
|
|
197
|
+
this.items.push(new AnsiConsoleItem(line, severity));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
this.fireDidChange();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
protected override fireDidChange = throttle(() => super.fireDidChange(), 50);
|
|
204
|
+
|
|
205
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2019 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-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { ContextKey } from '@theia/core/lib/browser/context-key-service';
|
|
18
|
-
|
|
19
|
-
export const DebugCallStackItemTypeKey = Symbol('DebugCallStackItemTypeKey');
|
|
20
|
-
export type DebugCallStackItemTypeKey = ContextKey<'session' | 'thread' | 'stackFrame'>;
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2019 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-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { ContextKey } from '@theia/core/lib/browser/context-key-service';
|
|
18
|
+
|
|
19
|
+
export const DebugCallStackItemTypeKey = Symbol('DebugCallStackItemTypeKey');
|
|
20
|
+
export type DebugCallStackItemTypeKey = ContextKey<'session' | 'thread' | 'stackFrame'>;
|