diff --git a/extensions/markdown-language-features/src/features/previewConfig.ts b/extensions/markdown-language-features/src/features/previewConfig.ts index ed09a9ce46eeb1f5f3e65ebb231e72a7a6889b6c..679f3c3ad775cb607982f298defd397fe06f5d38 100644 --- a/extensions/markdown-language-features/src/features/previewConfig.ts +++ b/extensions/markdown-language-features/src/features/previewConfig.ts @@ -4,6 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as vscode from 'vscode'; +import { equals } from '../util/arrays'; export class MarkdownPreviewConfiguration { public static getForResource(resource: vscode.Uri) { @@ -21,7 +22,7 @@ export class MarkdownPreviewConfiguration { public readonly lineHeight: number; public readonly fontSize: number; public readonly fontFamily: string | undefined; - public readonly styles: string[]; + public readonly styles: readonly string[]; private constructor(resource: vscode.Uri) { const editorConfig = vscode.workspace.getConfiguration('editor', resource); @@ -49,7 +50,7 @@ export class MarkdownPreviewConfiguration { } public isEqualTo(otherConfig: MarkdownPreviewConfiguration) { - for (let key in this) { + for (const key in this) { if (this.hasOwnProperty(key) && key !== 'styles') { if (this[key] !== otherConfig[key]) { return false; @@ -57,17 +58,7 @@ export class MarkdownPreviewConfiguration { } } - // Check styles - if (this.styles.length !== otherConfig.styles.length) { - return false; - } - for (let i = 0; i < this.styles.length; ++i) { - if (this.styles[i] !== otherConfig.styles[i]) { - return false; - } - } - - return true; + return equals(this.styles, otherConfig.styles); } [key: string]: any;