Skip to content

Commit 75f9756

Browse files
More reverted
1 parent 0f575da commit 75f9756

8 files changed

Lines changed: 32 additions & 26 deletions

File tree

packages/app-vscode/src/ScopeTreeProvider.ts

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export class ScopeTreeProvider implements TreeDataProvider<MyTreeItem> {
182182
};
183183
})();
184184

185-
return this.supportLevels
185+
const supportLevels = this.supportLevels
186186
.filter(
187187
(supportLevel) =>
188188
supportLevel.support === scopeSupport &&
@@ -201,26 +201,11 @@ export class ScopeTreeProvider implements TreeDataProvider<MyTreeItem> {
201201
isEqual(supportLevel.scopeType, this.scopeVisualizer.scopeType),
202202
getContainmentIcon?.(supportLevel.scopeType),
203203
),
204-
)
205-
.toSorted((a, b) => {
206-
if (
207-
a.scopeTypeInfo.spokenForm.type !== b.scopeTypeInfo.spokenForm.type
208-
) {
209-
// Scopes with no spoken form are sorted to the bottom
210-
return a.scopeTypeInfo.spokenForm.type === "error" ? 1 : -1;
211-
}
204+
);
212205

213-
if (
214-
a.scopeTypeInfo.isLanguageSpecific !==
215-
b.scopeTypeInfo.isLanguageSpecific
216-
) {
217-
// Then language-specific scopes are sorted to the top
218-
return a.scopeTypeInfo.isLanguageSpecific ? -1 : 1;
219-
}
206+
supportLevels.sort(compareScopeTypes);
220207

221-
// Then alphabetical by label
222-
return a.label.label.localeCompare(b.label.label);
223-
});
208+
return supportLevels;
224209
}
225210

226211
private getContainmentIcon(
@@ -255,6 +240,26 @@ export class ScopeTreeProvider implements TreeDataProvider<MyTreeItem> {
255240
}
256241
}
257242

243+
function compareScopeTypes(
244+
a: ScopeSupportTreeItem,
245+
b: ScopeSupportTreeItem,
246+
): number {
247+
if (a.scopeTypeInfo.spokenForm.type !== b.scopeTypeInfo.spokenForm.type) {
248+
// Scopes with no spoken form are sorted to the bottom
249+
return a.scopeTypeInfo.spokenForm.type === "error" ? 1 : -1;
250+
}
251+
252+
if (
253+
a.scopeTypeInfo.isLanguageSpecific !== b.scopeTypeInfo.isLanguageSpecific
254+
) {
255+
// Then language-specific scopes are sorted to the top
256+
return a.scopeTypeInfo.isLanguageSpecific ? -1 : 1;
257+
}
258+
259+
// Then alphabetical by label
260+
return a.label.label.localeCompare(b.label.label);
261+
}
262+
258263
function getSupportCategories(): SupportCategoryTreeItem[] {
259264
return [
260265
new SupportCategoryTreeItem(ScopeSupport.supportedAndPresentInEditor),

packages/lib-common/src/ide/inMemoryTextEditor/performEdits.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ function createChangeEvents(
4242
*/
4343
const sortedEdits = edits
4444
.map((edit, index) => ({ edit, index }))
45-
.toSorted((a, b) => {
45+
// oxlint-disable-next-line unicorn/no-array-sort
46+
.sort((a, b) => {
4647
// Edits starting at the same position are sorted in reverse given order.
4748
if (a.edit.range.start.isEqual(b.edit.range.start)) {
4849
return b.index - a.index;

packages/lib-engine/src/processTargets/modifiers/scopeHandlers/SentenceScopeHandler/SentenceScopeHandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export class SentenceScopeHandler extends NestedScopeHandler {
4242

4343
return direction === "forward"
4444
? imap(sentences, sentenceToScope)
45-
: Array.from(sentences, sentenceToScope).toReversed();
45+
: // oxlint-disable-next-line unicorn/no-array-sort
46+
Array.from(sentences, sentenceToScope).sort();
4647
}
4748
}

packages/lib-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/getDelimiterOccurrences.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,6 @@ function getSortedCaptures(items?: QueryCapture[]): QueryCapture[] {
9292
if (items == null) {
9393
return [];
9494
}
95-
return items.toSorted((a, b) => a.range.start.compareTo(b.range.start));
95+
items.sort((a, b) => a.range.start.compareTo(b.range.start));
96+
return items;
9697
}

packages/lib-engine/src/scopeProviders/ScopeSupportWatcher.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ export class ScopeSupportWatcher {
110110

111111
const scopeTypeInfos = this.scopeInfoProvider.getScopeTypeInfos();
112112

113-
// oxlint-disable-next-line oxc/no-map-spread
114113
return scopeTypeInfos.map((scopeTypeInfo) => ({
115114
...scopeTypeInfo,
116115
support: getScopeTypeSupport(scopeTypeInfo.scopeType),

packages/lib-engine/src/util/allocateHats/getRankedTokens.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export function getRankedTokens(
3535
const referencePosition = editor.selections[0].active;
3636
const displayLineMap = getDisplayLineMap(editor, [referencePosition.line]);
3737
const tokens = editor.visibleRanges.flatMap((range) =>
38-
// oxlint-disable-next-line oxc/no-map-spread
3938
getTokensInRange(ide, editor, range).map((partialToken) => ({
4039
...partialToken,
4140
displayLine: displayLineMap.get(partialToken.range.start.line)!,

packages/lib-engine/src/util/getMatchesInRange.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ export function generateMatchesInRange(
4343

4444
return direction === "forward"
4545
? imap(text.matchAll(regex), matchToRange)
46-
: Array.from(text.matchAll(regex), matchToRange).toReversed();
46+
: // oxlint-disable-next-line unicorn/no-array-sort
47+
Array.from(text.matchAll(regex), matchToRange).sort();
4748
}

packages/lib-engine/src/util/unifyRanges.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export function unifyRemovalTargets(targets: Target[]): Target[] {
77
if (targets.length < 2) {
88
return targets;
99
}
10-
// oxlint-disable-next-line oxc/no-map-spread
1110
return groupTargetsForEachEditor(targets).flatMap(
1211
([_editor, editorTargets]) => {
1312
if (editorTargets.length < 2) {

0 commit comments

Comments
 (0)