Skip to content

Commit 5efdeef

Browse files
authored
deprecate self-dispose object/pattern (microsoft#250815)
migrate cell entry fyi @DonJayamanne re microsoft#248366
1 parent cec2039 commit 5efdeef

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/vs/base/common/observableDisposable.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
import { Disposable, DisposableStore, IDisposable, toDisposable } from './lifecycle.js';
77

88
/**
9-
* Disposable object that tracks its {@linkcode isDisposed} state
10-
* as a public attribute and provides the {@linkcode onDispose}
11-
* event to subscribe to.
9+
* @deprecated do not use this, https://github.com/microsoft/vscode/issues/248366
1210
*/
1311
export abstract class ObservableDisposable extends Disposable {
1412
/**
@@ -68,16 +66,12 @@ export abstract class ObservableDisposable extends Disposable {
6866
}
6967

7068
/**
71-
* Type for a non-disposed object `TObject`.
69+
* @deprecated do not use this, https://github.com/microsoft/vscode/issues/248366
7270
*/
7371
type TNotDisposed<TObject extends { isDisposed: boolean }> = TObject & { isDisposed: false };
7472

7573
/**
76-
* Asserts that a provided `object` is not `disposed` yet,
77-
* e.g., its `disposed` property is `false`.
78-
*
79-
* @throws if the provided `object.disposed` equal to `false`.
80-
* @param error Error message or error object to throw if assertion fails.
74+
* @deprecated do not use this, https://github.com/microsoft/vscode/issues/248366
8175
*/
8276
export function assertNotDisposed<TObject extends { isDisposed: boolean }>(
8377
object: TObject,

src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { RunOnceScheduler } from '../../../../../../base/common/async.js';
7-
import { DisposableStore, toDisposable } from '../../../../../../base/common/lifecycle.js';
7+
import { Disposable, DisposableStore, toDisposable } from '../../../../../../base/common/lifecycle.js';
88
import { ITransaction, IObservable, observableValue, autorun, transaction } from '../../../../../../base/common/observable.js';
9-
import { ObservableDisposable } from '../../../../../../base/common/observableDisposable.js';
109
import { themeColorFromId } from '../../../../../../base/common/themables.js';
1110
import { URI } from '../../../../../../base/common/uri.js';
1211
import { EditOperation, ISingleEditOperation } from '../../../../../../editor/common/core/editOperation.js';
@@ -37,7 +36,7 @@ import { pendingRewriteMinimap } from '../chatEditingModifiedFileEntry.js';
3736
* Most of the code has been borrowed from there, as a cell is effectively a document.
3837
* Hence most of the same functionality applies.
3938
*/
40-
export class ChatEditingNotebookCellEntry extends ObservableDisposable {
39+
export class ChatEditingNotebookCellEntry extends Disposable {
4140
private static readonly _lastEditDecorationOptions = ModelDecorationOptions.register({
4241
isWholeLine: true,
4342
description: 'chat-last-edit',
@@ -60,6 +59,10 @@ export class ChatEditingNotebookCellEntry extends ObservableDisposable {
6059
});
6160

6261

62+
public get isDisposed(): boolean {
63+
return this._store.isDisposed;
64+
}
65+
6366
private _edit: StringEdit = StringEdit.empty;
6467
private _isEditFromUs: boolean = false;
6568
public get isEditFromUs(): boolean {

0 commit comments

Comments
 (0)