Skip to content

Commit

Permalink
don't clone outline model and simply share marker data, #140661
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jan 18, 2022
1 parent 5ce14fd commit ca73e74
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
26 changes: 0 additions & 26 deletions src/vs/editor/contrib/documentSymbols/outlineModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ export abstract class TreeElement {
abstract children: Map<string, TreeElement>;
abstract parent: TreeElement | undefined;

abstract adopt(newParent: TreeElement): TreeElement;

remove(): void {
if (this.parent) {
this.parent.children.delete(this.id);
Expand Down Expand Up @@ -107,14 +105,6 @@ export class OutlineElement extends TreeElement {
) {
super();
}

adopt(parent: TreeElement): OutlineElement {
let res = new OutlineElement(this.id, parent, this.symbol);
for (const [key, value] of this.children) {
res.children.set(key, value.adopt(res));
}
return res;
}
}

export class OutlineGroup extends TreeElement {
Expand All @@ -130,14 +120,6 @@ export class OutlineGroup extends TreeElement {
super();
}

adopt(parent: TreeElement): OutlineGroup {
let res = new OutlineGroup(this.id, parent, this.label, this.order);
for (const [key, value] of this.children) {
res.children.set(key, value.adopt(res));
}
return res;
}

getItemEnclosingPosition(position: IPosition): OutlineElement | undefined {
return position ? this._getItemEnclosingPosition(position, this.children) : undefined;
}
Expand Down Expand Up @@ -287,14 +269,6 @@ export class OutlineModel extends TreeElement {
this.parent = undefined;
}

adopt(): OutlineModel {
let res = new OutlineModel(this.uri);
for (const [key, value] of this._groups) {
res._groups.set(key, value.adopt(res));
}
return res._compact();
}

private _compact(): this {
let count = 0;
for (const [key, group] of this._groups) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,6 @@ class DocumentSymbolsOutline implements IOutline<DocumentSymbolItem> {
}
}

// copy the model
model = model.adopt();

// feature: show markers with outline element
this._applyMarkersToOutline(model);
this._outlineDisposables.add(this._markerDecorationsService.onDidChangeMarker(textModel => {
Expand Down

0 comments on commit ca73e74

Please sign in to comment.