Skip to content

Commit 08baedf

Browse files
committed
Improve DebugSessions label computation
also: * add missing parameter to DebugServiceImpl * remove unenecessary addition from Theia DebugConfiguration Co-authored-by: colin-grant-work <[email protected]> Contributed on behalf of STMicroelectronics
1 parent f5724fb commit 08baedf

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

packages/debug/src/browser/debug-session.tsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -749,19 +749,14 @@ export class DebugSession implements CompositeTreeElement {
749749
}
750750

751751
get label(): string {
752-
const showWSFolderInLabel = this.workspaceService.isMultiRootWorkspaceOpened && this.options.workspaceFolderUri;
753-
if (showWSFolderInLabel) {
754-
const wsFolder = this.labelProvider.getName(new URI(this.options.workspaceFolderUri));
755-
if (InternalDebugSessionOptions.is(this.options) && this.options.id) {
756-
return this.configuration.name + ' (' + (this.options.id + 1) + ' - ' + wsFolder + ')';
757-
}
758-
return this.configuration.name + ' (' + wsFolder + ')';
759-
} else {
760-
if (InternalDebugSessionOptions.is(this.options) && this.options.id) {
761-
return this.configuration.name + ' (' + (this.options.id + 1) + ')';
762-
}
763-
return this.configuration.name;
752+
const suffixes = [];
753+
if (InternalDebugSessionOptions.is(this.options) && this.options.id) {
754+
suffixes.push(String(this.options.id + 1));
755+
}
756+
if (this.workspaceService.isMultiRootWorkspaceOpened && this.options.workspaceFolderUri) {
757+
suffixes.push(this.labelProvider.getName(new URI(this.options.workspaceFolderUri)));
764758
}
759+
return suffixes.length === 0 ? this.configuration.name : this.configuration.name + `(${suffixes.join(' - ')})`;
765760
}
766761

767762
get visible(): boolean {

packages/debug/src/common/debug-configuration.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ export interface DebugConfiguration {
7777

7878
/** Indicates if it's a dynamic debug configuration */
7979
dynamic?: boolean;
80-
81-
/** The worspace folder used for looking up tasks, resolving variables, etc. */
82-
workspaceFolderUri?: string;
8380
}
8481
export namespace DebugConfiguration {
8582
export function is(arg: DebugConfiguration | any): arg is DebugConfiguration {

packages/debug/src/node/debug-service-impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class DebugServiceImpl implements DebugService {
6565
}
6666

6767
protected readonly sessions = new Set<string>();
68-
async createDebugSession(config: DebugConfiguration): Promise<string> {
68+
async createDebugSession(config: DebugConfiguration, _workspaceFolderUri?: string): Promise<string> {
6969
const session = await this.sessionManager.create(config, this.registry);
7070
this.sessions.add(session.id);
7171
return session.id;

0 commit comments

Comments
 (0)