Skip to content

Commit effb178

Browse files
committed
debug: a simplification with logDebugSessionStart
1 parent d2d69a5 commit effb178

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

src/vs/workbench/contrib/debug/browser/debugService.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { IAction } from 'vs/base/common/actions';
3333
import { deepClone, equals } from 'vs/base/common/objects';
3434
import { DebugSession } from 'vs/workbench/contrib/debug/browser/debugSession';
3535
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
36-
import { IDebugService, State, IDebugSession, CONTEXT_DEBUG_TYPE, CONTEXT_DEBUG_STATE, CONTEXT_IN_DEBUG_MODE, IThread, IDebugConfiguration, VIEWLET_ID, DEBUG_PANEL_ID, IConfig, ILaunch, IViewModel, IConfigurationManager, IDebugModel, IEnablement, IBreakpoint, IBreakpointData, ICompound, IStackFrame, getStateLabel, IDebugSessionOptions, CONTEXT_DEBUG_UX, REPL_VIEW_ID, CONTEXT_BREAKPOINTS_EXIST } from 'vs/workbench/contrib/debug/common/debug';
36+
import { IDebugService, State, IDebugSession, CONTEXT_DEBUG_TYPE, CONTEXT_DEBUG_STATE, CONTEXT_IN_DEBUG_MODE, IThread, IDebugConfiguration, VIEWLET_ID, DEBUG_PANEL_ID, IConfig, ILaunch, IViewModel, IConfigurationManager, IDebugModel, IEnablement, IBreakpoint, IBreakpointData, ICompound, IStackFrame, getStateLabel, IDebugSessionOptions, CONTEXT_DEBUG_UX, REPL_VIEW_ID, CONTEXT_BREAKPOINTS_EXIST, IGlobalConfig } from 'vs/workbench/contrib/debug/common/debug';
3737
import { getExtensionHostDebugSession } from 'vs/workbench/contrib/debug/common/debugUtils';
3838
import { isErrorWithActions } from 'vs/base/common/errorsWithActions';
3939
import { RunOnceScheduler } from 'vs/base/common/async';
@@ -521,7 +521,8 @@ export class DebugService implements IDebugService {
521521
try {
522522
await session.initialize(dbgr!);
523523
await session.launchOrAttach(session.configuration);
524-
await this.telemetry.logDebugSessionStart(dbgr!, session.root);
524+
const launchJsonExists = !!session.root && !!this.configurationService.getValue<IGlobalConfig>('launch', { resource: session.root.uri });
525+
await this.telemetry.logDebugSessionStart(dbgr!, launchJsonExists);
525526

526527
if (forceFocus || !this.viewModel.focusedSession || session.parentSession === this.viewModel.focusedSession) {
527528
await this.focusStackFrame(undefined, undefined, session);

src/vs/workbench/contrib/debug/common/debugTelemetry.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,18 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { IDebugModel, IDebugSession, AdapterEndEvent, IBreakpoint, IGlobalConfig } from 'vs/workbench/contrib/debug/common/debug';
7-
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
6+
import { IDebugModel, IDebugSession, AdapterEndEvent, IBreakpoint } from 'vs/workbench/contrib/debug/common/debug';
87
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
9-
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
108
import { Debugger } from 'vs/workbench/contrib/debug/common/debugger';
119

1210
export class DebugTelemetry {
1311

1412
constructor(
1513
private readonly model: IDebugModel,
1614
@ITelemetryService private readonly telemetryService: ITelemetryService,
17-
@IConfigurationService private readonly configurationService: IConfigurationService
1815
) { }
1916

20-
logDebugSessionStart(dbgr: Debugger, root: IWorkspaceFolder | undefined): Promise<void> {
17+
logDebugSessionStart(dbgr: Debugger, launchJsonExists: boolean): Promise<void> {
2118
const extension = dbgr.getMainExtensionDescriptor();
2219
/* __GDPR__
2320
"debugSessionStart" : {
@@ -37,7 +34,7 @@ export class DebugTelemetry {
3734
watchExpressionsCount: this.model.getWatchExpressions().length,
3835
extensionName: extension.identifier.value,
3936
isBuiltin: extension.isBuiltin,
40-
launchJsonExists: root && !!this.configurationService.getValue<IGlobalConfig>('launch', { resource: root.uri })
37+
launchJsonExists
4138
});
4239
}
4340

0 commit comments

Comments
 (0)