Skip to content

Commit 89c38d3

Browse files
committed
Update storage promise
A new doStore was added.
1 parent 14c96d7 commit 89c38d3

File tree

5 files changed

+10
-28
lines changed

5 files changed

+10
-28
lines changed

lib/vscode/src/vs/platform/storage/browser/storageService.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,8 @@ export class BrowserStorageService extends AbstractStorageService {
118118
return this.getStorage(scope).getNumber(key, fallbackValue);
119119
}
120120

121-
<<<<<<< HEAD
122-
store(key: string, value: string | boolean | number | undefined | null, scope: StorageScope): Promise<void> {
121+
protected doStore(key: string, value: string | boolean | number | undefined | null, scope: StorageScope): Promise<void> {
123122
return this.getStorage(scope).set(key, value);
124-
=======
125-
protected doStore(key: string, value: string | boolean | number | undefined | null, scope: StorageScope): void {
126-
this.getStorage(scope).set(key, value);
127-
>>>>>>> e4a830e9b7ca039c7c70697786d29f5b6679d775
128123
}
129124

130125
protected doRemove(key: string, scope: StorageScope): void {

lib/vscode/src/vs/platform/storage/common/storage.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,7 @@ export interface IStorageService {
104104
* @param target allows to define the target of the storage operation
105105
* to either the current machine or user.
106106
*/
107-
<<<<<<< HEAD
108-
store(key: string, value: string | boolean | number | undefined | null, scope: StorageScope): Promise<void> | void;
109-
=======
110-
store(key: string, value: string | boolean | number | undefined | null, scope: StorageScope, target: StorageTarget): void;
111-
>>>>>>> e4a830e9b7ca039c7c70697786d29f5b6679d775
107+
store(key: string, value: string | boolean | number | undefined | null, scope: StorageScope, target: StorageTarget): Promise<void> | void;
112108

113109
/**
114110
* Delete an element stored under the provided key from storage.
@@ -402,7 +398,7 @@ export abstract class AbstractStorageService extends Disposable implements IStor
402398
abstract getNumber(key: string, scope: StorageScope, fallbackValue: number): number;
403399
abstract getNumber(key: string, scope: StorageScope, fallbackValue?: number): number | undefined;
404400

405-
protected abstract doStore(key: string, value: string | boolean | number, scope: StorageScope): void;
401+
protected abstract doStore(key: string, value: string | boolean | number, scope: StorageScope): Promise<void> | void;
406402

407403
protected abstract doRemove(key: string, scope: StorageScope): void;
408404

lib/vscode/src/vs/platform/storage/node/storageService.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,8 @@ export class NativeStorageService extends AbstractStorageService {
188188
return this.getStorage(scope).getNumber(key, fallbackValue);
189189
}
190190

191-
<<<<<<< HEAD
192-
store(key: string, value: string | boolean | number | undefined | null, scope: StorageScope): Promise<void> {
191+
protected doStore(key: string, value: string | boolean | number | undefined | null, scope: StorageScope): Promise<void> {
193192
return this.getStorage(scope).set(key, value);
194-
=======
195-
protected doStore(key: string, value: string | boolean | number | undefined | null, scope: StorageScope): void {
196-
this.getStorage(scope).set(key, value);
197-
>>>>>>> e4a830e9b7ca039c7c70697786d29f5b6679d775
198193
}
199194

200195
protected doRemove(key: string, scope: StorageScope): void {

lib/vscode/src/vs/server/browser/client.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import { Emitter } from 'vs/base/common/event';
2+
import * as path from 'vs/base/common/path';
23
import { URI } from 'vs/base/common/uri';
34
import { localize } from 'vs/nls';
45
import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
56
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
67
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
78
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
9+
import { ILogService } from 'vs/platform/log/common/log';
810
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
911
import { Registry } from 'vs/platform/registry/common/platform';
1012
import { PersistentConnectionEventType } from 'vs/platform/remote/common/remoteAgentConnection';
13+
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
1114
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
1215
import { INodeProxyService, NodeProxyChannelClient } from 'vs/server/common/nodeProxy';
1316
import { TelemetryChannelClient } from 'vs/server/common/telemetry';
17+
import { Options } from 'vs/server/ipc.d';
1418
import 'vs/workbench/contrib/localizations/browser/localizations.contribution';
1519
import { LocalizationsService } from 'vs/workbench/services/localizations/electron-browser/localizationsService';
1620
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
17-
import { Options } from 'vs/server/ipc.d';
18-
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
19-
import { ILogService } from 'vs/platform/log/common/log';
20-
import * as path from 'vs/base/common/path';
2121

2222
class TelemetryService extends TelemetryChannelClient {
2323
public constructor(
@@ -179,7 +179,7 @@ export const initialize = async (services: ServiceCollection): Promise<void> =>
179179
}
180180
}
181181

182-
storageService.store('csLastUpdateNotification', Date.now(), StorageScope.GLOBAL);
182+
storageService.store('csLastUpdateNotification', Date.now(), StorageScope.GLOBAL, StorageTarget.MACHINE);
183183
(services.get(INotificationService) as INotificationService).notify({
184184
severity: Severity.Info,
185185
message: `[code-server v${json.latest}](https://github.com/cdr/code-server/releases/tag/v${json.latest}) has been released!`,

lib/vscode/src/vs/workbench/api/browser/mainThreadStorage.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,8 @@ export class MainThreadStorage implements MainThreadStorageShape {
6666
let jsonValue: string;
6767
try {
6868
jsonValue = JSON.stringify(value);
69-
<<<<<<< HEAD
70-
await this._storageService.store(key, jsonValue, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE);
71-
=======
7269
// Extension state is synced separately through extensions
73-
this._storageService.store(key, jsonValue, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE, StorageTarget.MACHINE);
74-
>>>>>>> e4a830e9b7ca039c7c70697786d29f5b6679d775
70+
await this._storageService.store(key, jsonValue, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE, StorageTarget.MACHINE);
7571
} catch (err) {
7672
return Promise.reject(err);
7773
}

0 commit comments

Comments
 (0)