Skip to content

Commit c031980

Browse files
committed
microsoft#99664 remove usage of deprecated keys util
1 parent 648e559 commit c031980

5 files changed

Lines changed: 15 additions & 21 deletions

File tree

src/vs/editor/common/services/markerDecorationsServiceImpl.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { themeColorFromId, ThemeColor } from 'vs/platform/theme/common/themeServ
1212
import { overviewRulerWarning, overviewRulerInfo, overviewRulerError } from 'vs/editor/common/view/editorColorRegistry';
1313
import { IModelService } from 'vs/editor/common/services/modelService';
1414
import { Range } from 'vs/editor/common/core/range';
15-
import { keys } from 'vs/base/common/map';
1615
import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDecorationService';
1716
import { Schemas } from 'vs/base/common/network';
1817
import { Emitter, Event } from 'vs/base/common/event';
@@ -32,7 +31,7 @@ class MarkerDecorations extends Disposable {
3231
) {
3332
super();
3433
this._register(toDisposable(() => {
35-
this.model.deltaDecorations(keys(this._markersData), []);
34+
this.model.deltaDecorations([...this._markersData.keys()], []);
3635
this._markersData.clear();
3736
}));
3837
}
@@ -42,7 +41,7 @@ class MarkerDecorations extends Disposable {
4241
}
4342

4443
public update(markers: IMarker[], newDecorations: IModelDeltaDecoration[]): boolean {
45-
const oldIds = keys(this._markersData);
44+
const oldIds = [...this._markersData.keys()];
4645
this._markersData.clear();
4746
const ids = this.model.deltaDecorations(oldIds, newDecorations);
4847
for (let index = 0; index < ids.length; index++) {

src/vs/platform/extensionManagement/common/extensionTipsService.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { CancellationToken } from 'vs/base/common/cancellation';
1414
import { ILogService } from 'vs/platform/log/common/log';
1515
import { joinPath } from 'vs/base/common/resources';
1616
import { getDomainsOfRemotes } from 'vs/platform/extensionManagement/common/configRemotes';
17-
import { keys } from 'vs/base/common/map';
1817

1918
export class ExtensionTipsService implements IExtensionTipsService {
2019

@@ -76,7 +75,7 @@ export class ExtensionTipsService implements IExtensionTipsService {
7675
});
7776
}
7877
});
79-
const domains = getDomainsOfRemotes(content.value.toString(), keys(recommendationByRemote));
78+
const domains = getDomainsOfRemotes(content.value.toString(), [...recommendationByRemote.keys()]);
8079
for (const domain of domains) {
8180
const remote = recommendationByRemote.get(domain);
8281
if (remote) {

src/vs/platform/userDataSync/common/extensionsMerge.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { keys } from 'vs/base/common/map';
76
import { ISyncExtension } from 'vs/platform/userDataSync/common/userDataSync';
87
import { IExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
98
import { startsWith } from 'vs/base/common/strings';
@@ -156,8 +155,8 @@ export function merge(localExtensions: ISyncExtension[], remoteExtensions: ISync
156155
}
157156

158157
function compare(from: Map<string, ISyncExtension> | null, to: Map<string, ISyncExtension>, ignoredExtensions: Set<string>, { checkInstalledProperty }: { checkInstalledProperty: boolean } = { checkInstalledProperty: false }): { added: Set<string>, removed: Set<string>, updated: Set<string> } {
159-
const fromKeys = from ? keys(from).filter(key => !ignoredExtensions.has(key)) : [];
160-
const toKeys = keys(to).filter(key => !ignoredExtensions.has(key));
158+
const fromKeys = from ? [...from.keys()].filter(key => !ignoredExtensions.has(key)) : [];
159+
const toKeys = [...to.keys()].filter(key => !ignoredExtensions.has(key));
161160
const added = toKeys.filter(key => fromKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set<string>());
162161
const removed = fromKeys.filter(key => toKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set<string>());
163162
const updated: Set<string> = new Set<string>();

src/vs/platform/userDataSync/common/keybindingsMerge.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import * as objects from 'vs/base/common/objects';
77
import { parse } from 'vs/base/common/json';
8-
import { keys } from 'vs/base/common/map';
98
import { IUserFriendlyKeybinding } from 'vs/platform/keybinding/common/keybinding';
109
import { firstIndex as findFirstIndex, equals } from 'vs/base/common/arrays';
1110
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
@@ -57,8 +56,8 @@ export async function merge(localContent: string, remoteContent: string, baseCon
5756
const remoteByCommand = byCommand(remote);
5857
const baseByCommand = base ? byCommand(base) : null;
5958
const localToRemoteByCommand = compareByCommand(localByCommand, remoteByCommand, normalizedKeys);
60-
const baseToLocalByCommand = baseByCommand ? compareByCommand(baseByCommand, localByCommand, normalizedKeys) : { added: keys(localByCommand).reduce((r, k) => { r.add(k); return r; }, new Set<string>()), removed: new Set<string>(), updated: new Set<string>() };
61-
const baseToRemoteByCommand = baseByCommand ? compareByCommand(baseByCommand, remoteByCommand, normalizedKeys) : { added: keys(remoteByCommand).reduce((r, k) => { r.add(k); return r; }, new Set<string>()), removed: new Set<string>(), updated: new Set<string>() };
59+
const baseToLocalByCommand = baseByCommand ? compareByCommand(baseByCommand, localByCommand, normalizedKeys) : { added: [...localByCommand.keys()].reduce((r, k) => { r.add(k); return r; }, new Set<string>()), removed: new Set<string>(), updated: new Set<string>() };
60+
const baseToRemoteByCommand = baseByCommand ? compareByCommand(baseByCommand, remoteByCommand, normalizedKeys) : { added: [...remoteByCommand.keys()].reduce((r, k) => { r.add(k); return r; }, new Set<string>()), removed: new Set<string>(), updated: new Set<string>() };
6261

6362
const commandsMergeResult = computeMergeResult(localToRemoteByCommand, baseToLocalByCommand, baseToRemoteByCommand);
6463
let mergeContent = localContent;
@@ -204,13 +203,13 @@ function computeMergeResultByKeybinding(local: IUserFriendlyKeybinding[], remote
204203
return { hasLocalForwarded: false, hasRemoteForwarded: false, added: empty, removed: empty, updated: empty, conflicts: empty };
205204
}
206205

207-
const baseToLocalByKeybinding = baseByKeybinding ? compareByKeybinding(baseByKeybinding, localByKeybinding) : { added: keys(localByKeybinding).reduce((r, k) => { r.add(k); return r; }, new Set<string>()), removed: new Set<string>(), updated: new Set<string>() };
206+
const baseToLocalByKeybinding = baseByKeybinding ? compareByKeybinding(baseByKeybinding, localByKeybinding) : { added: [...localByKeybinding.keys()].reduce((r, k) => { r.add(k); return r; }, new Set<string>()), removed: new Set<string>(), updated: new Set<string>() };
208207
if (baseToLocalByKeybinding.added.size === 0 && baseToLocalByKeybinding.removed.size === 0 && baseToLocalByKeybinding.updated.size === 0) {
209208
// Remote has moved forward and local has not.
210209
return { hasLocalForwarded: false, hasRemoteForwarded: true, added: empty, removed: empty, updated: empty, conflicts: empty };
211210
}
212211

213-
const baseToRemoteByKeybinding = baseByKeybinding ? compareByKeybinding(baseByKeybinding, remoteByKeybinding) : { added: keys(remoteByKeybinding).reduce((r, k) => { r.add(k); return r; }, new Set<string>()), removed: new Set<string>(), updated: new Set<string>() };
212+
const baseToRemoteByKeybinding = baseByKeybinding ? compareByKeybinding(baseByKeybinding, remoteByKeybinding) : { added: [...remoteByKeybinding.keys()].reduce((r, k) => { r.add(k); return r; }, new Set<string>()), removed: new Set<string>(), updated: new Set<string>() };
214213
if (baseToRemoteByKeybinding.added.size === 0 && baseToRemoteByKeybinding.removed.size === 0 && baseToRemoteByKeybinding.updated.size === 0) {
215214
return { hasLocalForwarded: true, hasRemoteForwarded: false, added: empty, removed: empty, updated: empty, conflicts: empty };
216215
}
@@ -250,8 +249,8 @@ function byCommand(keybindings: IUserFriendlyKeybinding[]): Map<string, IUserFri
250249

251250

252251
function compareByKeybinding(from: Map<string, IUserFriendlyKeybinding[]>, to: Map<string, IUserFriendlyKeybinding[]>): ICompareResult {
253-
const fromKeys = keys(from);
254-
const toKeys = keys(to);
252+
const fromKeys = [...from.keys()];
253+
const toKeys = [...to.keys()];
255254
const added = toKeys.filter(key => fromKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set<string>());
256255
const removed = fromKeys.filter(key => toKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set<string>());
257256
const updated: Set<string> = new Set<string>();
@@ -271,8 +270,8 @@ function compareByKeybinding(from: Map<string, IUserFriendlyKeybinding[]>, to: M
271270
}
272271

273272
function compareByCommand(from: Map<string, IUserFriendlyKeybinding[]>, to: Map<string, IUserFriendlyKeybinding[]>, normalizedKeys: IStringDictionary<string>): ICompareResult {
274-
const fromKeys = keys(from);
275-
const toKeys = keys(to);
273+
const fromKeys = [...from.keys()];
274+
const toKeys = [...to.keys()];
276275
const added = toKeys.filter(key => fromKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set<string>());
277276
const removed = fromKeys.filter(key => toKeys.indexOf(key) === -1).reduce((r, key) => { r.add(key); return r; }, new Set<string>());
278277
const updated: Set<string> = new Set<string>();

src/vs/workbench/services/preferences/common/preferencesModels.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { IStringDictionary } from 'vs/base/common/collections';
88
import { Emitter, Event } from 'vs/base/common/event';
99
import { JSONVisitor, visit } from 'vs/base/common/json';
1010
import { Disposable, IReference } from 'vs/base/common/lifecycle';
11-
import * as map from 'vs/base/common/map';
1211
import { assign } from 'vs/base/common/objects';
1312
import { URI } from 'vs/base/common/uri';
1413
import { IRange, Range } from 'vs/editor/common/core/range';
@@ -49,7 +48,7 @@ export abstract class AbstractSettingsModel extends EditorModel {
4948
*/
5049
private removeDuplicateResults(): void {
5150
const settingKeys = new Set<string>();
52-
map.keys(this._currentResultGroups)
51+
[...this._currentResultGroups.keys()]
5352
.sort((a, b) => this._currentResultGroups.get(a)!.order - this._currentResultGroups.get(b)!.order)
5453
.forEach(groupId => {
5554
const group = this._currentResultGroups.get(groupId)!;
@@ -752,8 +751,7 @@ export class DefaultSettingsEditorModel extends AbstractSettingsModel implements
752751
}
753752

754753
// Grab current result groups, only render non-empty groups
755-
const resultGroups = map
756-
.values(this._currentResultGroups)
754+
const resultGroups = [...this._currentResultGroups.values()]
757755
.sort((a, b) => a.order - b.order);
758756
const nonEmptyResultGroups = resultGroups.filter(group => group.result.filterMatches.length);
759757

0 commit comments

Comments
 (0)