debugger.ts ×26

Frontier kind: Code frontier

unlabeled · c_a9f04f5556d9

3 tests · 14665 LOC · 72 files · introduces 0 tests · 153 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
28 ranges153 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1918 ranges14665 lines · 72 files · Browse complete extent
All tests (intent)
3 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

3 files ranked by introduced lines: 153 introduced LOC across 28 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/debug/common/debugger.ts 143 introduced LOC · 26 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- debugger.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import * as nls from '../../../../nls.js';
7 > import { isObject } from '../../../../base/common/types.js';
8 > import { IJSONSchema, IJSONSchemaMap, IJSONSchemaSnippet } from '../../../../base/common/jsonSchema.js';
9 > import { IWorkspaceFolder } from '../../../../platform/workspace/common/workspace.js';
10 > import { IConfig, IDebuggerContribution, IDebugAdapter, IDebugger, IDebugSession, IAdapterManager, IDebugService, debuggerDisabledMessage, IDebuggerMetadata, DebugConfigurationProviderTriggerKind } from './debug.js';
11 > import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
12 > import { IConfigurationResolverService } from '../../../services/configurationResolver/common/configurationResolver.js';
13 > import * as ConfigurationResolverUtils from '../../../services/configurationResolver/common/configurationResolverUtils.js';
14 > import { ITextResourcePropertiesService } from '../../../../editor/common/services/textResourceConfiguration.js';
15 > import { URI } from '../../../../base/common/uri.js';
16 > import { Schemas } from '../../../../base/common/network.js';
17 > import { isDebuggerMainContribution } from './debugUtils.js';
18 > import { IExtensionDescription } from '../../../../platform/extensions/common/extensions.js';
19 > import { ITelemetryEndpoint } from '../../../../platform/telemetry/common/telemetry.js';
20 > import { cleanRemoteAuthority } from '../../../../platform/telemetry/common/telemetryUtils.js';
21 > import { IWorkbenchEnvironmentService } from '../../../services/environment/common/environmentService.js';
22 > import { ContextKeyExpr, ContextKeyExpression, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
23 > import { filter } from '../../../../base/common/objects.js';
24 > import { IProductService } from '../../../../platform/product/common/productService.js';
25 > import { ILogService } from '../../../../platform/log/common/log.js';
26 >
27 > export class Debugger implements IDebugger, IDebuggerMetadata {
28 >
29 > private debuggerContribution: IDebuggerContribution;
30 > private mergedExtensionDescriptions: IExtensionDescription[] = [];
31 > private mainExtensionDescription: IExtensionDescription | undefined;
32 >
33 > private debuggerWhen: ContextKeyExpression | undefined;
34 > private debuggerHiddenWhen: ContextKeyExpression | undefined;
35 >
36 > constructor(
37 > private adapterManager: IAdapterManager,
38 > dbgContribution: IDebuggerContribution,
39 > extensionDescription: IExtensionDescription,
40 > @IConfigurationService private readonly configurationService: IConfigurationService,
41 > @ITextResourcePropertiesService private readonly resourcePropertiesService: ITextResourcePropertiesService,
42 > @IConfigurationResolverService private readonly configurationResolverService: IConfigurationResolverService,
43 > @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
44 > @IDebugService private readonly debugService: IDebugService,
45 > @IContextKeyService private readonly contextKeyService: IContextKeyService,
46 > @IProductService private readonly productService: IProductService,
47 > @ILogService private readonly logService: ILogService,
48 > ) {
49 > this.debuggerContribution = { type: dbgContribution.type };
50 > this.merge(dbgContribution, extensionDescription);
51 >
52 > this.debuggerWhen = typeof this.debuggerContribution.when === 'string' ? ContextKeyExpr.deserialize(this.debuggerContribution.when) : undefined;
53 > this.debuggerHiddenWhen = typeof this.debuggerContribution.hiddenWhen === 'string' ? ContextKeyExpr.deserialize(this.debuggerContribution.hiddenWhen) : undefined;
54 > }
55 >
56 > merge(otherDebuggerContribution: IDebuggerContribution, extensionDescription: IExtensionDescription): void {
57 >
58 > /**
59 > * Copies all properties of source into destination. The optional parameter "overwrite" allows to control
60 > * if existing non-structured properties on the destination should be overwritten or not. Defaults to true (overwrite).
61 > */
62 > function mixin(destination: any, source: any, overwrite: boolean, level = 0): any {
63 >
64 > if (!isObject(destination)) {
65 return source;
66 }
68 > if (isObject(source)) {
69 > Object.keys(source).forEach(key => {
70 > if (key !== '__proto__') {
71 > if (isObject(destination[key]) && isObject(source[key])) {
72 mixin(destination[key], source[key], overwrite, level + 1);
73 > } else { debugger.ts
74 > if (key in destination) {
75 > if (overwrite) {
76 if (level === 0 && key === 'type') {
77 // don't merge the 'type' property
80 }
81 }
82 > } else { debugger.ts
83 > destination[key] = source[key];
84 > }
85 > }
86 > }
87 > });
88 > }
89 >
90 > return destination;
91 > }
92 >
93 > // only if not already merged
94 > if (this.mergedExtensionDescriptions.indexOf(extensionDescription) < 0) {
95 >
96 > // remember all extensions that have been merged for this debugger
97 > this.mergedExtensionDescriptions.push(extensionDescription);
98 >
99 > // merge new debugger contribution into existing contributions (and don't overwrite values in built-in extensions)
100 > mixin(this.debuggerContribution, otherDebuggerContribution, extensionDescription.isBuiltin);
101 >
102 > // remember the extension that is considered the "main" debugger contribution
103 > if (isDebuggerMainContribution(otherDebuggerContribution)) {
104 > this.mainExtensionDescription = extensionDescription;
105 > }
106 > }
107 > }
108 >
109 > async startDebugging(configuration: IConfig, parentSessionId: string): Promise<boolean> {
110 const parentSession = this.debugService.getModel().getSession(parentSessionId);
111 return await this.debugService.startDebugging(undefined, configuration, { parentSession }, undefined);
112 }
113 > debugger.ts
114 > async createDebugAdapter(session: IDebugSession): Promise<IDebugAdapter> {
115 await this.adapterManager.activateDebuggers('onDebugAdapterProtocolTracker', this.type);
116 const da = this.adapterManager.createDebugAdapter(session);
120 throw new Error(nls.localize('cannot.find.da', "Cannot find debug adapter for type '{0}'.", this.type));
121 }
122 > debugger.ts
123 > async substituteVariables(folder: IWorkspaceFolder | undefined, config: IConfig): Promise<IConfig | undefined> {
124 const substitutedConfig = await this.adapterManager.substituteVariables(this.type, folder, config);
125 return await this.configurationResolverService.resolveWithInteractionReplace(folder, substitutedConfig, 'launch', this.variables, substitutedConfig.__configurationTarget);
126 }
127 > debugger.ts
128 > runInTerminal(args: DebugProtocol.RunInTerminalRequestArguments, sessionId: string): Promise<number | undefined> {
129 return this.adapterManager.runInTerminal(this.type, args, sessionId);
130 }
131 > debugger.ts
132 > get label(): string {
133 return this.debuggerContribution.label || this.debuggerContribution.type;
134 }
135 > debugger.ts
136 > get type(): string {
137 return this.debuggerContribution.type;
138 }
139 > debugger.ts
140 > get variables(): { [key: string]: string } | undefined {
141 return this.debuggerContribution.variables;
142 }
143 > debugger.ts
144 > get configurationSnippets(): IJSONSchemaSnippet[] | undefined {
145 return this.debuggerContribution.configurationSnippets;
146 }
147 > debugger.ts
148 > get languages(): string[] | undefined {
149 return this.debuggerContribution.languages;
150 }
151 > debugger.ts
152 > get when(): ContextKeyExpression | undefined {
153 return this.debuggerWhen;
154 }
155 > debugger.ts
156 > get hiddenWhen(): ContextKeyExpression | undefined {
157 return this.debuggerHiddenWhen;
158 }
159 > debugger.ts
160 > get enabled() {
161 return !this.debuggerWhen || this.contextKeyService.contextMatchesRules(this.debuggerWhen);
162 }
163 > debugger.ts
164 > get isHiddenFromDropdown() {
165 if (!this.debuggerHiddenWhen) {
166 return false;
168 return this.contextKeyService.contextMatchesRules(this.debuggerHiddenWhen);
169 }
170 > debugger.ts
171 > get strings() {
172 return this.debuggerContribution.strings ?? this.debuggerContribution.uiMessages;
173 }
174 > debugger.ts
175 > interestedInLanguage(languageId: string): boolean {
176 return !!(this.languages && this.languages.indexOf(languageId) >= 0);
177 }
178 > debugger.ts
179 > hasInitialConfiguration(): boolean {
180 return !!this.debuggerContribution.initialConfigurations;
181 }
182 > debugger.ts
183 > hasDynamicConfigurationProviders(): boolean {
184 return this.debugService.getConfigurationManager().hasDebugConfigurationProvider(this.type, DebugConfigurationProviderTriggerKind.Dynamic);
185 }
186 > debugger.ts
187 > hasConfigurationProvider(): boolean {
188 return this.debugService.getConfigurationManager().hasDebugConfigurationProvider(this.type);
189 }
190 > debugger.ts
191 > getInitialConfigurationContent(initialConfigs?: IConfig[]): Promise<string> {
192 // at this point we got some configs from the package.json and/or from registered DebugConfigurationProviders
193 let initialConfigurations = this.debuggerContribution.initialConfigurations || [];
220 return Promise.resolve(content);
221 }
222 > debugger.ts
223 > getMainExtensionDescriptor(): IExtensionDescription {
224 return this.mainExtensionDescription || this.mergedExtensionDescriptions[0];
225 }
226 > debugger.ts
227 > getCustomTelemetryEndpoint(): ITelemetryEndpoint | undefined {
228 const aiKey = this.debuggerContribution.aiKey;
229 if (!aiKey) {
238 };
239 }
240 > debugger.ts
241 > getSchemaAttributes(definitions: IJSONSchemaMap): IJSONSchema[] | null {
242
243 if (!this.debuggerContribution.configurationAttributes) {
src/vs/workbench/services/configurationResolver/common/configurationResolverUtils.ts 8 introduced LOC · 1 range

Open complete file

1 > /*--------------------------------------------------------------------------------------------- configurationResolverUtils.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 > import * as nls from '../../../../nls.js';
6 > import { IJSONSchema } from '../../../../base/common/jsonSchema.js';
7 >
8 > export function applyDeprecatedVariableMessage(schema: IJSONSchema) {
9 schema.pattern = schema.pattern || '^(?!.*\\$\\{(env|config|command)\\.)';
10 schema.patternErrorMessage = schema.patternErrorMessage ||
src/vs/workbench/contrib/debug/common/debugUtils.ts 2 introduced LOC · 1 range

Open complete file

77 // only a debugger contributions with a label, program, or runtime attribute is considered a "defining" or "main" debugger contribution
78 export function isDebuggerMainContribution(dbg: IDebuggerContribution) {
79 > return dbg.type && (dbg.label || dbg.program || dbg.runtime); debugUtils.ts
80 > }
81
82 /**