提交 240afbde 编写于 作者: M Matt Bierner

Use array.equals

上级 7bf5773e
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import { equals } from '../util/arrays';
export class MarkdownPreviewConfiguration { export class MarkdownPreviewConfiguration {
public static getForResource(resource: vscode.Uri) { public static getForResource(resource: vscode.Uri) {
...@@ -21,7 +22,7 @@ export class MarkdownPreviewConfiguration { ...@@ -21,7 +22,7 @@ export class MarkdownPreviewConfiguration {
public readonly lineHeight: number; public readonly lineHeight: number;
public readonly fontSize: number; public readonly fontSize: number;
public readonly fontFamily: string | undefined; public readonly fontFamily: string | undefined;
public readonly styles: string[]; public readonly styles: readonly string[];
private constructor(resource: vscode.Uri) { private constructor(resource: vscode.Uri) {
const editorConfig = vscode.workspace.getConfiguration('editor', resource); const editorConfig = vscode.workspace.getConfiguration('editor', resource);
...@@ -49,7 +50,7 @@ export class MarkdownPreviewConfiguration { ...@@ -49,7 +50,7 @@ export class MarkdownPreviewConfiguration {
} }
public isEqualTo(otherConfig: MarkdownPreviewConfiguration) { public isEqualTo(otherConfig: MarkdownPreviewConfiguration) {
for (let key in this) { for (const key in this) {
if (this.hasOwnProperty(key) && key !== 'styles') { if (this.hasOwnProperty(key) && key !== 'styles') {
if (this[key] !== otherConfig[key]) { if (this[key] !== otherConfig[key]) {
return false; return false;
...@@ -57,17 +58,7 @@ export class MarkdownPreviewConfiguration { ...@@ -57,17 +58,7 @@ export class MarkdownPreviewConfiguration {
} }
} }
// Check styles return equals(this.styles, otherConfig.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;
} }
[key: string]: any; [key: string]: any;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册