Use equals helper
This commit is contained in:
parent
6b4258e724
commit
2393521d37
1 changed files with 2 additions and 15 deletions
|
@ -10,29 +10,16 @@ import API from '../utils/api';
|
||||||
import { Disposable } from '../utils/dispose';
|
import { Disposable } from '../utils/dispose';
|
||||||
import * as fileSchemes from '../utils/fileSchemes';
|
import * as fileSchemes from '../utils/fileSchemes';
|
||||||
import { isTypeScriptDocument } from '../utils/languageModeIds';
|
import { isTypeScriptDocument } from '../utils/languageModeIds';
|
||||||
|
import { equals } from '../utils/objects';
|
||||||
import { ResourceMap } from '../utils/resourceMap';
|
import { ResourceMap } from '../utils/resourceMap';
|
||||||
|
|
||||||
|
|
||||||
function objsAreEqual<T>(a: T, b: T): boolean {
|
|
||||||
let keys = Object.keys(a);
|
|
||||||
for (const key of keys) {
|
|
||||||
if ((a as any)[key] !== (b as any)[key]) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface FileConfiguration {
|
interface FileConfiguration {
|
||||||
readonly formatOptions: Proto.FormatCodeSettings;
|
readonly formatOptions: Proto.FormatCodeSettings;
|
||||||
readonly preferences: Proto.UserPreferences;
|
readonly preferences: Proto.UserPreferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
function areFileConfigurationsEqual(a: FileConfiguration, b: FileConfiguration): boolean {
|
function areFileConfigurationsEqual(a: FileConfiguration, b: FileConfiguration): boolean {
|
||||||
return (
|
return equals(a, b);
|
||||||
objsAreEqual(a.formatOptions, b.formatOptions)
|
|
||||||
&& objsAreEqual(a.preferences, b.preferences)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class FileConfigurationManager extends Disposable {
|
export default class FileConfigurationManager extends Disposable {
|
||||||
|
|
Loading…
Reference in a new issue