Improved debug locations

This commit is contained in:
Henning Dieterichs
2025-08-20 23:57:06 +02:00
committed by Henning Dieterichs
parent e61cfdaa4a
commit 173a6f9115
2 changed files with 6 additions and 5 deletions
@@ -54,7 +54,7 @@ export abstract class ConvenientObservable<T, TChange> implements IObservableWit
/** @sealed */
public map<TNew>(fn: (value: T, reader: IReader) => TNew): IObservable<TNew>;
public map<TNew>(owner: DebugOwner, fn: (value: T, reader: IReader) => TNew): IObservable<TNew>;
public map<TNew>(fnOrOwner: DebugOwner | ((value: T, reader: IReader) => TNew), fnOrUndefined?: (value: T, reader: IReader) => TNew): IObservable<TNew> {
public map<TNew>(fnOrOwner: DebugOwner | ((value: T, reader: IReader) => TNew), fnOrUndefined?: (value: T, reader: IReader) => TNew, debugLocation: DebugLocation = DebugLocation.ofCaller()): IObservable<TNew> {
const owner = fnOrUndefined === undefined ? undefined : fnOrOwner as DebugOwner;
const fn = fnOrUndefined === undefined ? fnOrOwner as (value: T, reader: IReader) => TNew : fnOrUndefined;
@@ -80,7 +80,8 @@ export abstract class ConvenientObservable<T, TChange> implements IObservableWit
},
debugReferenceFn: fn,
},
(reader) => fn(this.read(reader), reader)
(reader) => fn(this.read(reader), reader),
debugLocation,
);
}
@@ -5,7 +5,7 @@
import { equalsIfDefined, itemsEquals } from '../../base/common/equals.js';
import { Disposable, DisposableStore, IDisposable, toDisposable } from '../../base/common/lifecycle.js';
import { IObservable, IObservableWithChange, ITransaction, TransactionImpl, autorun, autorunOpts, derived, derivedOpts, derivedWithSetter, observableFromEvent, observableSignal, observableValue, observableValueOpts } from '../../base/common/observable.js';
import { DebugLocation, IObservable, IObservableWithChange, ITransaction, TransactionImpl, autorun, autorunOpts, derived, derivedOpts, derivedWithSetter, observableFromEvent, observableSignal, observableValue, observableValueOpts } from '../../base/common/observable.js';
import { EditorOption, FindComputedEditorOptionValueById } from '../common/config/editorOptions.js';
import { LineRange } from '../common/core/ranges/lineRange.js';
import { OffsetRange } from '../common/core/ranges/offsetRange.js';
@@ -280,10 +280,10 @@ export class ObservableCodeEditor extends Disposable {
public readonly domNode;
public getOption<T extends EditorOption>(id: T): IObservable<FindComputedEditorOptionValueById<T>> {
public getOption<T extends EditorOption>(id: T, debugLocation = DebugLocation.ofCaller()): IObservable<FindComputedEditorOptionValueById<T>> {
return observableFromEvent(this, cb => this.editor.onDidChangeConfiguration(e => {
if (e.hasChanged(id)) { cb(undefined); }
}), () => this.editor.getOption(id));
}), () => this.editor.getOption(id), debugLocation);
}
public setDecorations(decorations: IObservable<IModelDeltaDecoration[]>): IDisposable {