-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add 'cascadeTerminateToConfigurations' for better self-host tea…
…rdown See microsoft/vscode#100368
- Loading branch information
1 parent
f12eb45
commit 0da270a
Showing
12 changed files
with
134 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/*--------------------------------------------------------- | ||
* Copyright (C) Microsoft Corporation. All rights reserved. | ||
*--------------------------------------------------------*/ | ||
|
||
import { inject, injectable } from 'inversify'; | ||
import * as vscode from 'vscode'; | ||
import { DebugSessionTracker } from './debugSessionTracker'; | ||
|
||
/** | ||
* Watches for sessions to be terminated. When they are, it runs cascading | ||
* termination if configured. | ||
*/ | ||
@injectable() | ||
export class CascadeTerminationTracker { | ||
constructor(@inject(DebugSessionTracker) private readonly tracker: DebugSessionTracker) {} | ||
|
||
/** | ||
* Registers the tracker for the extension. | ||
*/ | ||
public register(context: vscode.ExtensionContext) { | ||
context.subscriptions.push( | ||
this.tracker.onSessionEnded(session => { | ||
const targets: string[] = session.configuration.cascadeTerminateToConfigurations; | ||
if (!targets || !(targets instanceof Array)) { | ||
return; // may be a nested session | ||
} | ||
|
||
for (const configName of targets) { | ||
for (const session of this.tracker.getByName(configName)) { | ||
vscode.debug.stopDebugging(session); | ||
} | ||
} | ||
}), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.