mirror of
https://github.com/Microsoft/vscode
synced 2024-09-12 21:24:38 +00:00
Merge pull request #214338 from microsoft/tyriar/214234_2
Register more terminal listeners
This commit is contained in:
commit
d7eb0f15bd
|
@ -38,7 +38,7 @@ export class ElectronPtyHostStarter extends Disposable implements IPtyHostStarte
|
|||
) {
|
||||
super();
|
||||
|
||||
this._lifecycleMainService.onWillShutdown(() => this._onWillShutdown.fire());
|
||||
this._register(this._lifecycleMainService.onWillShutdown(() => this._onWillShutdown.fire()));
|
||||
// Listen for new windows to establish connection directly to pty host
|
||||
validatedIpcMain.on('vscode:createPtyHostMessageChannel', (e, nonce) => this._onWindowConnection(e, nonce));
|
||||
this._register(toDisposable(() => {
|
||||
|
|
|
@ -108,14 +108,16 @@ export class PtyHostService extends Disposable implements IPtyHostService {
|
|||
this._register(toDisposable(() => this._disposePtyHost()));
|
||||
|
||||
this._resolveVariablesRequestStore = this._register(new RequestStore(undefined, this._logService));
|
||||
this._resolveVariablesRequestStore.onCreateRequest(this._onPtyHostRequestResolveVariables.fire, this._onPtyHostRequestResolveVariables);
|
||||
this._register(this._resolveVariablesRequestStore.onCreateRequest(this._onPtyHostRequestResolveVariables.fire, this._onPtyHostRequestResolveVariables));
|
||||
|
||||
// Start the pty host when a window requests a connection, if the starter has that capability.
|
||||
if (this._ptyHostStarter.onRequestConnection) {
|
||||
Event.once(this._ptyHostStarter.onRequestConnection)(() => this._ensurePtyHost());
|
||||
this._register(Event.once(this._ptyHostStarter.onRequestConnection)(() => this._ensurePtyHost()));
|
||||
}
|
||||
|
||||
this._ptyHostStarter.onWillShutdown?.(() => this._wasQuitRequested = true);
|
||||
if (this._ptyHostStarter.onWillShutdown) {
|
||||
this._register(this._ptyHostStarter.onWillShutdown(() => this._wasQuitRequested = true));
|
||||
}
|
||||
}
|
||||
|
||||
private get _ignoreProcessNames(): string[] {
|
||||
|
|
|
@ -921,7 +921,7 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
|
|||
public getEnvironmentVariableCollection(extension: IExtensionDescription): IEnvironmentVariableCollection {
|
||||
let collection = this._environmentVariableCollections.get(extension.identifier.value);
|
||||
if (!collection) {
|
||||
collection = new UnifiedEnvironmentVariableCollection();
|
||||
collection = this._register(new UnifiedEnvironmentVariableCollection());
|
||||
this._setEnvironmentVariableCollection(extension.identifier.value, collection);
|
||||
}
|
||||
return collection.getScopedEnvironmentVariableCollection(undefined);
|
||||
|
@ -936,7 +936,7 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
|
|||
public $initEnvironmentVariableCollections(collections: [string, ISerializableEnvironmentVariableCollection][]): void {
|
||||
collections.forEach(entry => {
|
||||
const extensionIdentifier = entry[0];
|
||||
const collection = new UnifiedEnvironmentVariableCollection(entry[1]);
|
||||
const collection = this._register(new UnifiedEnvironmentVariableCollection(entry[1]));
|
||||
this._setEnvironmentVariableCollection(extensionIdentifier, collection);
|
||||
});
|
||||
}
|
||||
|
@ -952,20 +952,20 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
|
|||
|
||||
private _setEnvironmentVariableCollection(extensionIdentifier: string, collection: UnifiedEnvironmentVariableCollection): void {
|
||||
this._environmentVariableCollections.set(extensionIdentifier, collection);
|
||||
collection.onDidChangeCollection(() => {
|
||||
this._register(collection.onDidChangeCollection(() => {
|
||||
// When any collection value changes send this immediately, this is done to ensure
|
||||
// following calls to createTerminal will be created with the new environment. It will
|
||||
// result in more noise by sending multiple updates when called but collections are
|
||||
// expected to be small.
|
||||
this._syncEnvironmentVariableCollection(extensionIdentifier, collection);
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unified environment variable collection carrying information for all scopes, for a specific extension.
|
||||
*/
|
||||
class UnifiedEnvironmentVariableCollection {
|
||||
class UnifiedEnvironmentVariableCollection extends Disposable {
|
||||
readonly map: Map<string, IEnvironmentVariableMutator> = new Map();
|
||||
private readonly scopedCollections: Map<string, ScopedEnvironmentVariableCollection> = new Map();
|
||||
readonly descriptionMap: Map<string, IEnvironmentVariableCollectionDescription> = new Map();
|
||||
|
@ -983,6 +983,7 @@ class UnifiedEnvironmentVariableCollection {
|
|||
constructor(
|
||||
serialized?: ISerializableEnvironmentVariableCollection
|
||||
) {
|
||||
super();
|
||||
this.map = new Map(serialized);
|
||||
}
|
||||
|
||||
|
@ -992,7 +993,7 @@ class UnifiedEnvironmentVariableCollection {
|
|||
if (!scopedCollection) {
|
||||
scopedCollection = new ScopedEnvironmentVariableCollection(this, scope);
|
||||
this.scopedCollections.set(scopedCollectionKey, scopedCollection);
|
||||
scopedCollection.onDidChangeCollection(() => this._onDidChangeCollection.fire());
|
||||
this._register(scopedCollection.onDidChangeCollection(() => this._onDidChangeCollection.fire()));
|
||||
}
|
||||
return scopedCollection;
|
||||
}
|
||||
|
|
|
@ -337,16 +337,16 @@ export class TerminalService extends Disposable implements ITerminalService {
|
|||
}
|
||||
|
||||
private _forwardInstanceHostEvents(host: ITerminalInstanceHost) {
|
||||
host.onDidChangeInstances(this._onDidChangeInstances.fire, this._onDidChangeInstances);
|
||||
host.onDidDisposeInstance(this._onDidDisposeInstance.fire, this._onDidDisposeInstance);
|
||||
host.onDidChangeActiveInstance(instance => this._evaluateActiveInstance(host, instance));
|
||||
host.onDidFocusInstance(instance => {
|
||||
this._register(host.onDidChangeInstances(this._onDidChangeInstances.fire, this._onDidChangeInstances));
|
||||
this._register(host.onDidDisposeInstance(this._onDidDisposeInstance.fire, this._onDidDisposeInstance));
|
||||
this._register(host.onDidChangeActiveInstance(instance => this._evaluateActiveInstance(host, instance)));
|
||||
this._register(host.onDidFocusInstance(instance => {
|
||||
this._onDidFocusInstance.fire(instance);
|
||||
this._evaluateActiveInstance(host, instance);
|
||||
});
|
||||
host.onDidChangeInstanceCapability((instance) => {
|
||||
}));
|
||||
this._register(host.onDidChangeInstanceCapability((instance) => {
|
||||
this._onDidChangeInstanceCapability.fire(instance);
|
||||
});
|
||||
}));
|
||||
this._hostActiveTerminals.set(host, undefined);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue