chore: cleanup code

This commit is contained in:
mathuo 2024-05-14 20:33:14 +01:00
parent 9ee2b821ff
commit d29052e606
No known key found for this signature in database
GPG Key ID: C6EEDEFD6CA07281
4 changed files with 14 additions and 13 deletions

View File

@ -28,8 +28,7 @@ export interface DockviewGroupPanelFloatingChangeEvent {
readonly location: DockviewGroupLocation;
}
// TODO find a better way to initialize and avoid needing null checks
const NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
const NOT_INITIALIZED_MESSAGE = 'dockview: DockviewGroupPanelApiImpl not initialized';
export class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
private readonly _mutableDisposable = new MutableDisposable();
@ -130,15 +129,16 @@ export class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
}
initialize(group: DockviewGroupPanel): void {
this._group = group;
/**
* TODO: Annoying initialization order caveat
* TODO: Annoying initialization order caveat, find a better way to initialize and avoid needing null checks
*
* Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
* By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
* finished ensuring the `model` is defined.
*/
this._group = group;
queueMicrotask(() => {
this._mutableDisposable.value =
this._group!.model.onDidActivePanelChange((event) => {

View File

@ -1,7 +1,5 @@
class TransferObject {
constructor() {
// intentionally empty class
}
// intentionally empty class
}
export class PanelTransfer extends TransferObject {

View File

@ -828,7 +828,7 @@ export class DockviewComponent
this.updateWatermark();
})
.catch((err) => {
console.error(err);
console.error('dockview: failed to create popout window', err);
});
}
@ -2104,7 +2104,7 @@ export class DockviewComponent
if (id && this._groups.has(options.id!)) {
console.warn(
`Duplicate group id ${options?.id}. reassigning group id to avoid errors`
`dockview: Duplicate group id ${options?.id}. reassigning group id to avoid errors`
);
id = undefined;
}

View File

@ -69,7 +69,7 @@ class Stacktrace {
private constructor(readonly value: string) {}
print(): void {
console.warn(this.value);
console.warn('dockview: stacktrace', this.value);
}
}
@ -124,7 +124,7 @@ export class Emitter<T> implements IDisposable {
this._listeners.splice(index, 1);
} else if (Emitter.ENABLE_TRACKING) {
// console.warn(
// `Listener already disposed`,
// `dockview: listener already disposed`,
// Stacktrace.create().print()
// );
}
@ -158,7 +158,10 @@ export class Emitter<T> implements IDisposable {
queueMicrotask(() => {
// don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
for (const listener of this._listeners) {
console.warn(listener.stacktrace?.print());
console.warn(
'dockview: stacktrace',
listener.stacktrace?.print()
);
}
});
}