Fix a few double disposable registrations (#224895)

These values are being registered on a disposable store more than once. I think some of the instances in tests are actually leaking the `MutableObservableValue` too since it's not registered
This commit is contained in:
Matt Bierner 2024-08-05 16:21:07 -07:00 committed by GitHub
parent 8b232e3eab
commit 5cc310c11b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 10 deletions

View file

@ -437,8 +437,7 @@ export class SearchWidget extends Widget {
protected createInputBox(parent: HTMLElement): HistoryInputBox {
const showHistoryHint = () => showHistoryKeybindingHint(this.keybindingService);
const box = this._register(new ContextScopedHistoryInputBox(parent, this.contextViewService, { ...this.options, showHistoryHint }, this.contextKeyService));
return box;
return new ContextScopedHistoryInputBox(parent, this.contextViewService, { ...this.options, showHistoryHint }, this.contextKeyService);
}
showMessage(message: string): void {

View file

@ -92,18 +92,18 @@ export class TestingPeekOpener extends Disposable implements ITestingPeekOpener
private lastUri?: TestUriWithDocument;
/** @inheritdoc */
public readonly historyVisible = MutableObservableValue.stored(this._register(new StoredValue<boolean>({
public readonly historyVisible = this._register(MutableObservableValue.stored(new StoredValue<boolean>({
key: 'testHistoryVisibleInPeek',
scope: StorageScope.PROFILE,
target: StorageTarget.USER,
}, this.storageService)), false);
}, this.storageService), false));
/** @inheritdoc */
public readonly callStackVisible = MutableObservableValue.stored(this._register(new StoredValue<boolean>({
public readonly callStackVisible = this._register(MutableObservableValue.stored(new StoredValue<boolean>({
key: 'testCallStackVisible',
scope: StorageScope.PROFILE,
target: StorageTarget.USER,
}, this.storageService)), true);
}, this.storageService), true));
constructor(
@IConfigurationService private readonly configuration: IConfigurationService,

View file

@ -13,7 +13,7 @@ import { InternalTestItem } from 'vs/workbench/contrib/testing/common/testTypes'
export class TestExclusions extends Disposable {
private readonly excluded = this._register(
MutableObservableValue.stored(this._register(new StoredValue<ReadonlySet<string>>({
MutableObservableValue.stored(new StoredValue<ReadonlySet<string>>({
key: 'excludedTestItems',
scope: StorageScope.WORKSPACE,
target: StorageTarget.MACHINE,
@ -21,7 +21,7 @@ export class TestExclusions extends Disposable {
deserialize: v => new Set(JSON.parse(v)),
serialize: v => JSON.stringify([...v])
},
}, this.storageService)), new Set())
}, this.storageService), new Set())
);
constructor(@IStorageService private readonly storageService: IStorageService) {

View file

@ -82,11 +82,11 @@ export class TestService extends Disposable implements ITestService {
/**
* @inheritdoc
*/
public readonly showInlineOutput = MutableObservableValue.stored(this._register(new StoredValue<boolean>({
public readonly showInlineOutput = this._register(MutableObservableValue.stored(new StoredValue<boolean>({
key: 'inlineTestOutputVisible',
scope: StorageScope.WORKSPACE,
target: StorageTarget.USER
}, this.storage)), true);
}, this.storage), true));
constructor(
@IContextKeyService contextKeyService: IContextKeyService,