Skip to content

Commit

Permalink
better range usage
Browse files Browse the repository at this point in the history
  • Loading branch information
amunger committed Sep 25, 2023
1 parent d772d04 commit 61af497
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,9 @@ export class NotebookCellOutline implements IOutline<OutlineEntry> {
return Disposable.None;
}


if (entry.range) {
const range = new Range(entry.range.startLineNumber, entry.range.startColumn, entry.range.endLineNumber, entry.range.endColumn);
const range = Range.lift(entry.range);
widget.revealRangeInCenterIfOutsideViewportAsync(entry.cell, range);
} else {
widget.revealInCenterIfOutsideViewport(entry.cell);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { IRange } from 'vs/editor/common/core/range';
import { SymbolKind, SymbolKinds } from 'vs/editor/common/languages';


export interface IOutlineMarkerInfo {
readonly count: number;
readonly topSev: MarkerSeverity;
Expand All @@ -38,7 +37,6 @@ export class OutlineEntry {
readonly label: string,
readonly isExecuting: boolean,
readonly isPaused: boolean,
readonly position?: IRange,
readonly range?: IRange,
readonly symbolKind?: SymbolKind,
) { }
Expand All @@ -60,6 +58,13 @@ export class OutlineEntry {
return this._markerInfo;
}

get position() {
if (this.range) {
return { startLineNumber: this.range.startLineNumber, startColumn: this.range.startColumn };
}
return undefined;
}

updateMarkers(markerService: IMarkerService): void {
if (this.cell.cellKind === CellKind.Code) {
// a code cell can have marker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ export class NotebookOutlineEntryFactory {
// So symbols need to be precached before this function is called to get the full list.
if (cachedEntries) {
cachedEntries.forEach((cached) => {
const position = { ...cached.range, endLineNumber: cached.range.startLineNumber, endColumn: cached.range.startColumn };
entries.push(new OutlineEntry(index++, cached.level, cell, cached.name, false, false, position, cached.range, cached.kind));
entries.push(new OutlineEntry(index++, cached.level, cell, cached.name, false, false, cached.range, cached.kind));
});
}
}
Expand Down

0 comments on commit 61af497

Please sign in to comment.