Use array.find in more places of re-implementing it with for loops

This commit is contained in:
Matt Bierner
2019-10-07 14:35:04 -07:00
parent d1b81e23db
commit 4e2caaa646
14 changed files with 42 additions and 123 deletions

View File

@@ -12,6 +12,7 @@ import * as strings from 'vs/base/common/strings';
import { Range } from 'vs/editor/common/core/range';
import { isWindows } from 'vs/base/common/platform';
import { Schemas } from 'vs/base/common/network';
import { find } from 'vs/base/common/arrays';
export interface ICreateData {
workspaceFolders: string[];
@@ -44,15 +45,9 @@ export class OutputLinkComputer {
});
}
private getModel(uri: string): IMirrorModel | null {
private getModel(uri: string): IMirrorModel | undefined {
const models = this.ctx.getMirrorModels();
for (const model of models) {
if (model.uri.toString() === uri) {
return model;
}
}
return null;
return find(models, model => model.uri.toString() === uri);
}
public computeLinks(uri: string): Promise<ILink[]> {