cleanup ES6 iterables utils in Comments.

This commit is contained in:
rebornix
2020-06-24 11:36:52 -07:00
parent 205b0e3d82
commit c487e751c3

View File

@@ -6,7 +6,6 @@
import { CancellationToken } from 'vs/base/common/cancellation';
import { Emitter, Event } from 'vs/base/common/event';
import { Disposable, DisposableStore, dispose, IDisposable } from 'vs/base/common/lifecycle';
import { keys } from 'vs/base/common/map';
import { URI, UriComponents } from 'vs/base/common/uri';
import { generateUuid } from 'vs/base/common/uuid';
import { IRange } from 'vs/editor/common/core/range';
@@ -284,7 +283,7 @@ export class MainThreadCommentController {
async getDocumentComments(resource: URI, token: CancellationToken) {
let ret: modes.CommentThread[] = [];
for (let thread of keys(this._threads)) {
for (let thread of [...this._threads.keys()]) {
const commentThread = this._threads.get(thread)!;
if (commentThread.resource === resource.toString()) {
ret.push(commentThread);
@@ -315,7 +314,7 @@ export class MainThreadCommentController {
getAllComments(): MainThreadCommentThread[] {
let ret: MainThreadCommentThread[] = [];
for (let thread of keys(this._threads)) {
for (let thread of [...this._threads.keys()]) {
ret.push(this._threads.get(thread)!);
}
@@ -486,7 +485,7 @@ export class MainThreadComments extends Disposable implements MainThreadComments
if (!commentsPanelAlreadyConstructed && !this._openViewListener) {
this._openViewListener = this._viewsService.onDidChangeViewVisibility(e => {
if (e.id === COMMENTS_VIEW_ID && e.visible) {
keys(this._commentControllers).forEach(handle => {
[...this._commentControllers.keys()].forEach(handle => {
let threads = this._commentControllers.get(handle)!.getAllComments();
if (threads.length) {