Skip to content

Commit ca1a8f6

Browse files
author
aiday-mar
committed
Using iterable.first
1 parent 3b243ba commit ca1a8f6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/vs/editor/contrib/stickyScroll/browser/stickyScrollProvider.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { RunOnceScheduler } from 'vs/base/common/async';
1313
import { Range } from 'vs/editor/common/core/range';
1414
import { Emitter } from 'vs/base/common/event';
1515
import { binarySearch } from 'vs/base/common/arrays';
16+
import { Iterable } from 'vs/base/common/iterator';
1617

1718
export class StickyRange {
1819
constructor(
@@ -112,7 +113,7 @@ export class StickyLineCandidateProvider extends Disposable {
112113
return;
113114
}
114115
// When several possible outline providers
115-
if (outlineModel.children.size !== 0 && outlineModel.children.values().next().value instanceof OutlineGroup) {
116+
if (outlineModel.children.size !== 0 && Iterable.first(outlineModel.children) instanceof OutlineGroup) {
116117
if (outlineModel.children.has(this._providerString)) {
117118
outlineModel = outlineModel.children.get(this._providerString) as unknown as OutlineModel;
118119
} else {
@@ -129,7 +130,7 @@ export class StickyLineCandidateProvider extends Disposable {
129130
outlineModel = outlineModel.children.get(this._providerString) as unknown as OutlineModel;
130131
}
131132
}
132-
this._outlineModel = StickyOutlineElement.fromOutlineModel(outlineModel);
133+
this._outlineModel = StickyOutlineElement.fromOutlineModel(outlineModel, -1);
133134
this._modelVersionId = modelVersionId;
134135
}
135136
}

0 commit comments

Comments
 (0)