Skip to content

Commit 2660504

Browse files
committed
💄 forof over foreach
1 parent 0da75b9 commit 2660504

1 file changed

Lines changed: 16 additions & 18 deletions

File tree

src/vs/workbench/api/common/extHostNotebook.ts

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
15171517
let editorChanged = false;
15181518

15191519
if (delta.removedDocuments) {
1520-
delta.removedDocuments.forEach((uri) => {
1520+
for (const uri of delta.removedDocuments) {
15211521
const revivedUri = URI.revive(uri);
15221522
const document = this._documents.get(revivedUri);
15231523

@@ -1528,21 +1528,21 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
15281528
this._onDidCloseNotebookDocument.fire(document);
15291529
}
15301530

1531-
[...this._editors.values()].forEach((e) => {
1531+
for (const e of this._editors.values()) {
15321532
if (e.editor.uri.toString() === revivedUri.toString()) {
15331533
e.editor.dispose();
15341534
this._editors.delete(e.editor.id);
15351535
editorChanged = true;
15361536
}
1537-
});
1538-
});
1537+
}
1538+
}
15391539
}
15401540

15411541
if (delta.addedDocuments) {
15421542

15431543
const addedCellDocuments: IModelAddedData[] = [];
15441544

1545-
delta.addedDocuments.forEach(modelData => {
1545+
for (const modelData of delta.addedDocuments) {
15461546
const revivedUri = URI.revive(modelData.uri);
15471547
const viewType = modelData.viewType;
15481548
const entry = this._notebookContentProviders.get(viewType);
@@ -1606,11 +1606,11 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
16061606

16071607
const document = this._documents.get(revivedUri)!;
16081608
this._onDidOpenNotebookDocument.fire(document);
1609-
});
1609+
}
16101610
}
16111611

16121612
if (delta.addedEditors) {
1613-
delta.addedEditors.forEach(editorModelData => {
1613+
for (const editorModelData of delta.addedEditors) {
16141614
if (this._editors.has(editorModelData.id)) {
16151615
return;
16161616
}
@@ -1622,13 +1622,13 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
16221622
this._createExtHostEditor(document, editorModelData.id, editorModelData.selections);
16231623
editorChanged = true;
16241624
}
1625-
});
1625+
}
16261626
}
16271627

16281628
const removedEditors: { editor: ExtHostNotebookEditor; }[] = [];
16291629

16301630
if (delta.removedEditors) {
1631-
delta.removedEditors.forEach(editorid => {
1631+
for (const editorid of delta.removedEditors) {
16321632
const editor = this._editors.get(editorid);
16331633

16341634
if (editor) {
@@ -1641,7 +1641,7 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
16411641

16421642
removedEditors.push(editor);
16431643
}
1644-
});
1644+
}
16451645
}
16461646

16471647
if (editorChanged) {
@@ -1655,10 +1655,10 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
16551655
const visibleEditorsSet = new Set<string>();
16561656
this.visibleNotebookEditors.forEach(editor => visibleEditorsSet.add(editor.id));
16571657

1658-
[...this._editors.values()].forEach((e) => {
1658+
for (const e of this._editors.values()) {
16591659
const newValue = visibleEditorsSet.has(e.editor.id);
16601660
e.editor._acceptVisibility(newValue);
1661-
});
1661+
}
16621662

16631663
this.visibleNotebookEditors = [...this._editors.values()].map(e => e.editor).filter(e => e.visible);
16641664
this._onDidChangeVisibleNotebookEditors.fire(this.visibleNotebookEditors);
@@ -1668,19 +1668,17 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
16681668
if (delta.newActiveEditor) {
16691669
this._activeNotebookEditor = this._editors.get(delta.newActiveEditor)?.editor;
16701670
this._activeNotebookEditor?._acceptActive(true);
1671-
[...this._editors.values()].forEach((e) => {
1671+
for (const e of this._editors.values()) {
16721672
if (e.editor !== this.activeNotebookEditor) {
16731673
e.editor._acceptActive(false);
16741674
}
1675-
});
1675+
}
16761676
} else {
16771677
// clear active notebook as current active editor is non-notebook editor
16781678
this._activeNotebookEditor = undefined;
1679-
1680-
[...this._editors.values()].forEach((e) => {
1679+
for (const e of this._editors.values()) {
16811680
e.editor._acceptActive(false);
1682-
});
1683-
1681+
}
16841682
}
16851683

16861684
this._onDidChangeActiveNotebookEditor.fire(this._activeNotebookEditor);

0 commit comments

Comments
 (0)