提交 d7626d68 编写于 作者: B Benjamin Pasero

Never show again storage keys are registered too late for syncing (fix #93817)

上级 46679eee
......@@ -65,7 +65,7 @@ export interface INeverShowAgainOptions {
/**
* Whether to persist the choice in the current workspace or for all workspaces. By
* default it will be persisted for all workspaces.
* default it will be persisted for all workspaces (= `NeverShowAgainScope.GLOBAL`).
*/
readonly scope?: NeverShowAgainScope;
}
......
......@@ -11,6 +11,7 @@ import { registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { IEditorContribution } from 'vs/editor/common/editorCommon';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
/**
* Shows a message when opening a large file which has been memory optimized (and features disabled).
......@@ -23,9 +24,13 @@ export class LargeFileOptimizationsWarner extends Disposable implements IEditorC
private readonly _editor: ICodeEditor,
@INotificationService private readonly _notificationService: INotificationService,
@IConfigurationService private readonly _configurationService: IConfigurationService,
@IStorageKeysSyncRegistryService storageKeysSyncRegistryService: IStorageKeysSyncRegistryService
) {
super();
// opt-in to syncing
const neverShowAgainId = 'editor.contrib.largeFileOptimizationsWarner';
storageKeysSyncRegistryService.registerStorageKey({ key: neverShowAgainId, version: 1 });
this._register(this._editor.onDidChangeModel((e) => {
const model = this._editor.getModel();
......@@ -56,7 +61,7 @@ export class LargeFileOptimizationsWarner extends Disposable implements IEditorC
});
}
}
], { neverShowAgain: { id: 'editor.contrib.largeFileOptimizationsWarner' } });
], { neverShowAgain: { id: neverShowAgainId } });
}
}));
}
......
......@@ -15,6 +15,7 @@ import { URI } from 'vs/base/common/uri';
import { ITextModel } from 'vs/editor/common/model';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
/**
* Shows a message when semantic tokens are shown the first time.
......@@ -30,10 +31,15 @@ export class SemanticTokensHelp extends Disposable implements IEditorContributio
@INotificationService _notificationService: INotificationService,
@IOpenerService _openerService: IOpenerService,
@IWorkbenchThemeService _themeService: IWorkbenchThemeService,
@IEditorService _editorService: IEditorService
@IEditorService _editorService: IEditorService,
@IStorageKeysSyncRegistryService storageKeysSyncRegistryService: IStorageKeysSyncRegistryService
) {
super();
// opt-in to syncing
const neverShowAgainId = 'editor.contrib.semanticTokensHelp';
storageKeysSyncRegistryService.registerStorageKey({ key: neverShowAgainId, version: 1 });
const toDispose = this._register(new DisposableStore());
const localToDispose = toDispose.add(new DisposableStore());
const installChangeTokenListener = (model: ITextModel) => {
......@@ -75,7 +81,7 @@ export class SemanticTokensHelp extends Disposable implements IEditorContributio
_openerService.open(URI.parse(url));
}
}
], { neverShowAgain: { id: 'editor.contrib.semanticTokensHelp' } });
], { neverShowAgain: { id: neverShowAgainId } });
}));
};
......
......@@ -241,9 +241,13 @@ class ResolveSaveConflictAction extends Action {
@IEditorService private readonly editorService: IEditorService,
@INotificationService private readonly notificationService: INotificationService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IProductService private readonly productService: IProductService
@IProductService private readonly productService: IProductService,
@IStorageKeysSyncRegistryService storageKeysSyncRegistryService: IStorageKeysSyncRegistryService
) {
super('workbench.files.action.resolveConflict', nls.localize('compareChanges', "Compare"));
// opt-in to syncing
storageKeysSyncRegistryService.registerStorageKey({ key: LEARN_MORE_DIRTY_WRITE_IGNORE_KEY, version: 1 });
}
async run(): Promise<void> {
......
......@@ -50,6 +50,7 @@ export class LocalizationWorkbenchContribution extends Disposable implements IWo
super();
storageKeysSyncRegistryService.registerStorageKey({ key: LANGUAGEPACK_SUGGESTION_IGNORE_STORAGE_KEY, version: 1 });
storageKeysSyncRegistryService.registerStorageKey({ key: 'langugage.update.donotask', version: 1 });
this.checkAndInstall();
this._register(this.extensionManagementService.onDidInstallExtension(e => this.onDidInstallExtension(e)));
}
......
......@@ -21,6 +21,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { InstallRecommendedExtensionAction } from 'vs/workbench/contrib/extensions/browser/extensionsActions';
import { IProductService } from 'vs/platform/product/common/productService';
import { XTermCore } from 'vs/workbench/contrib/terminal/browser/xterm-private';
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
const MINIMUM_FONT_SIZE = 6;
const MAXIMUM_FONT_SIZE = 25;
......@@ -47,7 +48,8 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper {
@IStorageService private readonly _storageService: IStorageService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IProductService private readonly productService: IProductService
@IProductService private readonly productService: IProductService,
@IStorageKeysSyncRegistryService storageKeysSyncRegistryService: IStorageKeysSyncRegistryService
) {
this._updateConfig();
this._configurationService.onDidChangeConfiguration(e => {
......@@ -55,6 +57,9 @@ export class TerminalConfigHelper implements IBrowserTerminalConfigHelper {
this._updateConfig();
}
});
// opt-in to syncing
storageKeysSyncRegistryService.registerStorageKey({ key: 'terminalConfigHelper/launchRecommendationsIgnore', version: 1 });
}
private _updateConfig(): void {
......
......@@ -29,6 +29,7 @@ import { ShowCurrentReleaseNotesActionId, CheckForVSCodeUpdateActionId } from 'v
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { IProductService } from 'vs/platform/product/common/productService';
import product from 'vs/platform/product/common/product';
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
export const CONTEXT_UPDATE_STATE = new RawContextKey<string>('updateState', StateType.Idle);
......@@ -179,12 +180,16 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
@IActivityService private readonly activityService: IActivityService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IProductService private readonly productService: IProductService,
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService,
@IStorageKeysSyncRegistryService storageKeysSyncRegistryService: IStorageKeysSyncRegistryService
) {
super();
this.state = updateService.state;
this.updateStateContextKey = CONTEXT_UPDATE_STATE.bindTo(this.contextKeyService);
// opt-in to syncing
storageKeysSyncRegistryService.registerStorageKey({ key: 'neverShowAgain:update/win32-fast-updates', version: 1 });
this._register(updateService.onStateChange(this.onUpdateStateChange, this));
this.onUpdateStateChange(this.updateService.state);
......
......@@ -11,7 +11,6 @@ import { Event } from 'vs/base/common/event';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { IAction, Action } from 'vs/base/common/actions';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
export class NotificationService extends Disposable implements INotificationService {
......@@ -21,8 +20,7 @@ export class NotificationService extends Disposable implements INotificationServ
get model(): INotificationsModel { return this._model; }
constructor(
@IStorageService private readonly storageService: IStorageService,
@IStorageKeysSyncRegistryService private readonly storageKeysSyncRegistryService: IStorageKeysSyncRegistryService
@IStorageService private readonly storageService: IStorageService
) {
super();
}
......@@ -70,11 +68,6 @@ export class NotificationService extends Disposable implements INotificationServ
const scope = notification.neverShowAgain.scope === NeverShowAgainScope.WORKSPACE ? StorageScope.WORKSPACE : StorageScope.GLOBAL;
const id = notification.neverShowAgain.id;
// opt-in to syncing if global
if (scope === StorageScope.GLOBAL) {
this.storageKeysSyncRegistryService.registerStorageKey({ key: id, version: 1 });
}
// If the user already picked to not show the notification
// again, we return with a no-op notification here
if (this.storageService.getBoolean(id, scope)) {
......@@ -126,11 +119,6 @@ export class NotificationService extends Disposable implements INotificationServ
const scope = options.neverShowAgain.scope === NeverShowAgainScope.WORKSPACE ? StorageScope.WORKSPACE : StorageScope.GLOBAL;
const id = options.neverShowAgain.id;
// opt-in to syncing if global
if (scope === StorageScope.GLOBAL) {
this.storageKeysSyncRegistryService.registerStorageKey({ key: id, version: 1 });
}
// If the user already picked to not show the notification
// again, we return with a no-op notification here
if (this.storageService.getBoolean(id, scope)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册