mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
fix #74887
This commit is contained in:
@@ -21,8 +21,8 @@ import { extname, join } from 'vs/base/common/path';
|
||||
import { equals } from 'vs/base/common/objects';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IConfigurationModel, compare } from 'vs/platform/configuration/common/configuration';
|
||||
import { createSHA1 } from 'vs/base/browser/hash';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
import { hash } from 'vs/base/common/hash';
|
||||
|
||||
export class RemoteUserConfiguration extends Disposable {
|
||||
|
||||
@@ -672,7 +672,7 @@ class CachedFolderConfiguration extends Disposable implements IFolderConfigurati
|
||||
readonly onDidChange: Event<void> = this._onDidChange.event;
|
||||
|
||||
private configurationModel: ConfigurationModel;
|
||||
private readonly key: Thenable<ConfigurationKey>;
|
||||
private readonly key: ConfigurationKey;
|
||||
|
||||
constructor(
|
||||
folder: URI,
|
||||
@@ -680,14 +680,13 @@ class CachedFolderConfiguration extends Disposable implements IFolderConfigurati
|
||||
private readonly configurationCache: IConfigurationCache
|
||||
) {
|
||||
super();
|
||||
this.key = createSHA1(join(folder.path, configFolderRelativePath)).then(key => ({ type: 'folder', key }));
|
||||
this.key = { type: 'folder', key: hash(join(folder.path, configFolderRelativePath)).toString(16) };
|
||||
this.configurationModel = new ConfigurationModel();
|
||||
}
|
||||
|
||||
async loadConfiguration(): Promise<ConfigurationModel> {
|
||||
try {
|
||||
const key = await this.key;
|
||||
const contents = await this.configurationCache.read(key);
|
||||
const contents = await this.configurationCache.read(this.key);
|
||||
const parsed: IConfigurationModel = JSON.parse(contents.toString());
|
||||
this.configurationModel = new ConfigurationModel(parsed.contents, parsed.keys, parsed.overrides);
|
||||
} catch (e) {
|
||||
@@ -696,11 +695,10 @@ class CachedFolderConfiguration extends Disposable implements IFolderConfigurati
|
||||
}
|
||||
|
||||
async updateConfiguration(configurationModel: ConfigurationModel): Promise<void> {
|
||||
const key = await this.key;
|
||||
if (configurationModel.keys.length) {
|
||||
await this.configurationCache.write(key, JSON.stringify(configurationModel.toJSON()));
|
||||
await this.configurationCache.write(this.key, JSON.stringify(configurationModel.toJSON()));
|
||||
} else {
|
||||
await this.configurationCache.remove(key);
|
||||
await this.configurationCache.remove(this.key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user