diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index 73c1e7669c771098b0145d6e6cc174201ee919c9..a6442a9038c189c619490d8175160ac740b5bf0b 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -7,6 +7,7 @@ import * as nls from 'vs/nls'; import { Emitter, Event } from 'vs/base/common/event'; import { Disposable } from 'vs/base/common/lifecycle'; import * as objects from 'vs/base/common/objects'; +import * as arrays from 'vs/base/common/arrays'; import * as platform from 'vs/base/common/platform'; import { IEditorOptions, editorOptionsRegistry, ValidatedEditorOptions, IEnvironmentalOptions, ComputedEditorOptions, ConfigurationChangedEvent, EDITOR_FONT_DEFAULTS, EditorOptions, EDITOR_MODEL_DEFAULTS, EditorOption } from 'vs/editor/common/config/editorOptions'; import { EditorZoom } from 'vs/editor/common/config/editorZoom'; @@ -97,11 +98,26 @@ class EditorConfiguration2 { return result; } + private static _deepEquals(a: T, b: T): boolean { + if (typeof a !== 'object' || typeof b !== 'object') { + return (a === b); + } + if (Array.isArray(a) || Array.isArray(b)) { + return (Array.isArray(a) && Array.isArray(b) ? arrays.equals(a, b) : false); + } + for (let key in a) { + if (!EditorConfiguration2._deepEquals(a[key], b[key])) { + return false; + } + } + return true; + } + public static checkEquals(a: ComputedEditorOptions, b: ComputedEditorOptions): ConfigurationChangedEvent | null { const result: boolean[] = []; let somethingChanged = false; for (const editorOption of editorOptionsRegistry) { - const changed = !editorOption.equals(a._read(editorOption.id), b._read(editorOption.id)); + const changed = !EditorConfiguration2._deepEquals(a._read(editorOption.id), b._read(editorOption.id)); result[editorOption.id] = changed; if (changed) { somethingChanged = true; diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index 8fb99020115ec35a0363ce899ea017619e1ad68f..13c42151c9d8088fcf023aa9b4702520b909ecfd 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -5,8 +5,6 @@ import * as nls from 'vs/nls'; import * as assert from 'vs/base/common/assert'; -import * as arrays from 'vs/base/common/arrays'; -import * as objects from 'vs/base/common/objects'; import * as platform from 'vs/base/common/platform'; import { ScrollbarVisibility } from 'vs/base/common/scrollable'; import { FontInfo } from 'vs/editor/common/config/fontInfo'; @@ -1144,10 +1142,6 @@ export interface IEditorOption> extends BaseEditorOption { @@ -1296,12 +1287,6 @@ class EditorRenderLineNumbersOption public compute(env: IEnvironmentalOptions, options: IComputedEditorOptions, value: number[]): number[] { return value; } - public equals(a: number[], b: number[]): boolean { - return arrays.equals(a, b); - } } //#endregion @@ -1593,9 +1543,6 @@ class EditorFontInfo