diff --git a/src/vs/platform/windows/electron-main/windowsService.ts b/src/vs/platform/windows/electron-main/windowsService.ts index 8a14f019d40..da1b56c7ee9 100644 --- a/src/vs/platform/windows/electron-main/windowsService.ts +++ b/src/vs/platform/windows/electron-main/windowsService.ts @@ -343,9 +343,6 @@ export class WindowsService extends Disposable implements IWindowsService, IURLH if (path.scheme === Schemas.file) { shell.showItemInFolder(path.fsPath); } - if (path.scheme === Schemas.userData) { - shell.showItemInFolder(path.path); - } } async getActiveWindowId(): Promise { diff --git a/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts b/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts index 0502f67ed52..6ebb9b3e3fe 100644 --- a/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts +++ b/src/vs/workbench/contrib/files/browser/fileActions.contribution.ts @@ -199,6 +199,7 @@ const copyRelativePathCommand = { // Editor Title Context Menu appendEditorTitleContextMenuItem(COPY_PATH_COMMAND_ID, copyPathCommand.title, ResourceContextKey.IsFileSystemResource, '1_cutcopypaste'); appendEditorTitleContextMenuItem(COPY_RELATIVE_PATH_COMMAND_ID, copyRelativePathCommand.title, ResourceContextKey.IsFileSystemResource, '1_cutcopypaste'); +appendEditorTitleContextMenuItem(REVEAL_IN_OS_COMMAND_ID, REVEAL_IN_OS_LABEL, ResourceContextKey.Scheme.isEqualTo(Schemas.file)); appendEditorTitleContextMenuItem(REVEAL_IN_EXPLORER_COMMAND_ID, nls.localize('revealInSideBar', "Reveal in Side Bar"), ResourceContextKey.IsFileSystemResource); function appendEditorTitleContextMenuItem(id: string, title: string, when: ContextKeyExpr, group?: string): void { diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index d2866eadc0e..9d2b119c091 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -26,9 +26,6 @@ import { NoEditorsVisibleContext, SingleEditorGroupsContext } from 'vs/workbench import { IWindowService, IWindowsService } from 'vs/platform/windows/common/windows'; import { LogStorageAction } from 'vs/platform/storage/node/storageService'; import product from 'vs/platform/product/node/product'; -import { REVEAL_IN_OS_COMMAND_ID, REVEAL_IN_OS_LABEL } from '../contrib/files/browser/fileCommands'; -import { ResourceContextKey } from 'vs/workbench/common/resources'; -import { Schemas } from 'vs/base/common/network'; // Actions (function registerActions(): void { @@ -63,17 +60,6 @@ import { Schemas } from 'vs/base/common/network'; primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_R, mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KEY_R } }); - - MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { - command: { id: REVEAL_IN_OS_COMMAND_ID, title: REVEAL_IN_OS_LABEL }, - when: ResourceContextKey.Scheme.isEqualTo(Schemas.file), - group: '2_files' - }); - MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { - command: { id: REVEAL_IN_OS_COMMAND_ID, title: REVEAL_IN_OS_LABEL }, - when: ResourceContextKey.Scheme.isEqualTo(Schemas.userData), - group: '2_files' - }); })(); // Actions: View diff --git a/src/vs/workbench/services/configuration/browser/configuration.ts b/src/vs/workbench/services/configuration/browser/configuration.ts index 515c6df2fe3..6fd5e062785 100644 --- a/src/vs/workbench/services/configuration/browser/configuration.ts +++ b/src/vs/workbench/services/configuration/browser/configuration.ts @@ -9,7 +9,7 @@ import { Event, Emitter } from 'vs/base/common/event'; import * as errors from 'vs/base/common/errors'; import { Disposable, IDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle'; import { RunOnceScheduler } from 'vs/base/common/async'; -import { FileChangeType, FileChangesEvent, IFileService } from 'vs/platform/files/common/files'; +import { FileChangeType, FileChangesEvent } from 'vs/platform/files/common/files'; import { ConfigurationModel, ConfigurationModelParser } from 'vs/platform/configuration/common/configurationModels'; import { WorkspaceConfigurationModelParser, StandaloneConfigurationModelParser } from 'vs/workbench/services/configuration/common/configurationModels'; import { FOLDER_SETTINGS_PATH, TASKS_CONFIGURATION_KEY, FOLDER_SETTINGS_NAME, LAUNCH_CONFIGURATION_KEY, IConfigurationCache, ConfigurationKey, REMOTE_MACHINE_SCOPES, FOLDER_SCOPES, WORKSPACE_SCOPES, ConfigurationFileService } from 'vs/workbench/services/configuration/common/configuration'; @@ -24,50 +24,11 @@ import { IConfigurationModel } from 'vs/platform/configuration/common/configurat import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; import { hash } from 'vs/base/common/hash'; -export class UserConfiguration extends Disposable { - - private readonly parser: ConfigurationModelParser; - private readonly reloadConfigurationScheduler: RunOnceScheduler; - protected readonly _onDidChangeConfiguration: Emitter = this._register(new Emitter()); - readonly onDidChangeConfiguration: Event = this._onDidChangeConfiguration.event; - - constructor( - private readonly userSettingsResource: URI, - private readonly scopes: ConfigurationScope[] | undefined, - private readonly fileService: IFileService - ) { - super(); - - this.parser = new ConfigurationModelParser(this.userSettingsResource.toString(), this.scopes); - this.reloadConfigurationScheduler = this._register(new RunOnceScheduler(() => this.reload().then(configurationModel => this._onDidChangeConfiguration.fire(configurationModel)), 50)); - this._register(Event.filter(this.fileService.onFileChanges, e => e.contains(this.userSettingsResource))(() => this.reloadConfigurationScheduler.schedule())); - } - - async initialize(): Promise { - return this.reload(); - } - - async reload(): Promise { - try { - const content = await this.fileService.readFile(this.userSettingsResource); - this.parser.parseContent(content.value.toString() || '{}'); - return this.parser.configurationModel; - } catch (e) { - return new ConfigurationModel(); - } - } - - reprocess(): ConfigurationModel { - this.parser.parse(); - return this.parser.configurationModel; - } -} - export class RemoteUserConfiguration extends Disposable { private readonly _cachedConfiguration: CachedRemoteUserConfiguration; private readonly _configurationFileService: ConfigurationFileService; - private _userConfiguration: FileServiceBasedRemoteUserConfiguration | CachedRemoteUserConfiguration; + private _userConfiguration: UserConfiguration | CachedRemoteUserConfiguration; private _userConfigurationInitializationPromise: Promise | null = null; private readonly _onDidChangeConfiguration: Emitter = this._register(new Emitter()); @@ -84,7 +45,7 @@ export class RemoteUserConfiguration extends Disposable { this._userConfiguration = this._cachedConfiguration = new CachedRemoteUserConfiguration(remoteAuthority, configurationCache); remoteAgentService.getEnvironment().then(async environment => { if (environment) { - const userConfiguration = this._register(new FileServiceBasedRemoteUserConfiguration(environment.settingsPath, REMOTE_MACHINE_SCOPES, this._configurationFileService)); + const userConfiguration = this._register(new UserConfiguration(environment.settingsPath, REMOTE_MACHINE_SCOPES, this._configurationFileService)); this._register(userConfiguration.onDidChangeConfiguration(configurationModel => this.onDidUserConfigurationChange(configurationModel))); this._userConfigurationInitializationPromise = userConfiguration.initialize(); const configurationModel = await this._userConfigurationInitializationPromise; @@ -96,7 +57,7 @@ export class RemoteUserConfiguration extends Disposable { } async initialize(): Promise { - if (this._userConfiguration instanceof FileServiceBasedRemoteUserConfiguration) { + if (this._userConfiguration instanceof UserConfiguration) { return this._userConfiguration.initialize(); } @@ -129,7 +90,7 @@ export class RemoteUserConfiguration extends Disposable { } } -class FileServiceBasedRemoteUserConfiguration extends Disposable { +export class UserConfiguration extends Disposable { private readonly parser: ConfigurationModelParser; private readonly reloadConfigurationScheduler: RunOnceScheduler; diff --git a/src/vs/workbench/services/configuration/browser/configurationService.ts b/src/vs/workbench/services/configuration/browser/configurationService.ts index b2b2f3469f9..769c02a678d 100644 --- a/src/vs/workbench/services/configuration/browser/configurationService.ts +++ b/src/vs/workbench/services/configuration/browser/configurationService.ts @@ -81,7 +81,7 @@ export class WorkspaceService extends Disposable implements IConfigurationServic this.configurationFileService = new ConfigurationFileService(fileService); this._configuration = new Configuration(this.defaultConfiguration, new ConfigurationModel(), new ConfigurationModel(), new ConfigurationModel(), new ResourceMap(), new ConfigurationModel(), new ResourceMap(), this.workspace); this.cachedFolderConfigs = new ResourceMap(); - this.localUserConfiguration = this._register(new UserConfiguration(environmentService.settingsResource, remoteAuthority ? LOCAL_MACHINE_SCOPES : undefined, fileService)); + this.localUserConfiguration = this._register(new UserConfiguration(environmentService.settingsResource, remoteAuthority ? LOCAL_MACHINE_SCOPES : undefined, this.configurationFileService)); this._register(this.localUserConfiguration.onDidChangeConfiguration(userConfiguration => this.onLocalUserConfigurationChanged(userConfiguration))); if (remoteAuthority) { this.remoteUserConfiguration = this._register(new RemoteUserConfiguration(remoteAuthority, configurationCache, this.configurationFileService, remoteAgentService)); diff --git a/src/vs/workbench/services/environment/browser/environmentService.ts b/src/vs/workbench/services/environment/browser/environmentService.ts index 95f1bbf6a30..e2578dd1a1b 100644 --- a/src/vs/workbench/services/environment/browser/environmentService.ts +++ b/src/vs/workbench/services/environment/browser/environmentService.ts @@ -72,8 +72,8 @@ export class BrowserWorkbenchEnvironmentService implements IEnvironmentService { if (remoteUserDataUri) { this.appSettingsHome = remoteUserDataUri || URI.file('/User').with({ scheme: Schemas.userData }); - this.settingsResource = joinPath(this.appSettingsHome, 'settings.json').with({ scheme: Schemas.userData }); - this.keybindingsResource = joinPath(this.appSettingsHome, 'keybindings.json').with({ scheme: Schemas.userData }); + this.settingsResource = joinPath(this.appSettingsHome, 'settings.json'); + this.keybindingsResource = joinPath(this.appSettingsHome, 'keybindings.json'); } else { const appSettingsHome = URI.file('/User').with({ scheme: Schemas.userData }); this.settingsResource = joinPath(appSettingsHome, 'settings.json'); diff --git a/src/vs/workbench/services/environment/node/environmentService.ts b/src/vs/workbench/services/environment/node/environmentService.ts index bb72c8785b8..db2a229c03b 100644 --- a/src/vs/workbench/services/environment/node/environmentService.ts +++ b/src/vs/workbench/services/environment/node/environmentService.ts @@ -6,10 +6,6 @@ import { EnvironmentService } from 'vs/platform/environment/node/environmentService'; import { IWindowConfiguration } from 'vs/platform/windows/common/windows'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; -import { memoize } from 'vs/base/common/decorators'; -import { URI } from 'vs/base/common/uri'; -import { joinPath } from 'vs/base/common/resources'; -import { Schemas } from 'vs/base/common/network'; export class WorkbenchEnvironmentService extends EnvironmentService implements IWorkbenchEnvironmentService { @@ -25,10 +21,4 @@ export class WorkbenchEnvironmentService extends EnvironmentService implements I get configuration(): IWindowConfiguration { return this._configuration; } - - @memoize - get settingsResource(): URI { return joinPath(this.appSettingsHome, 'settings.json').with({ scheme: Schemas.userData }); } - - @memoize - get keybindingsResource(): URI { return joinPath(this.appSettingsHome, 'keybindings.json').with({ scheme: Schemas.userData }); } }