Merge from vscode f2d41726ba5a0e8abfe61b2c743022b1b6372010 (#7415)

* Merge from vscode f2d41726ba5a0e8abfe61b2c743022b1b6372010

* add missing files
This commit is contained in:
Anthony Dresser
2019-09-27 23:30:36 -07:00
committed by GitHub
parent d0fb6de390
commit bca7c8e6bd
123 changed files with 1704 additions and 1330 deletions

View File

@@ -8,7 +8,6 @@ import 'vs/css!./media/actions';
import * as nls from 'vs/nls';
import { Action } from 'vs/base/common/actions';
import { IWindowOpenable } from 'vs/platform/windows/common/windows';
import { IWorkspacesHistoryService } from 'vs/workbench/services/workspace/common/workspacesHistoryService';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { Registry } from 'vs/platform/registry/common/platform';
@@ -22,7 +21,7 @@ import { ILabelService } from 'vs/platform/label/common/label';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IRecentWorkspace, IRecentFolder, IRecentFile, IRecent, isRecentFolder, isRecentWorkspace } from 'vs/platform/workspaces/common/workspacesHistory';
import { IRecentWorkspace, IRecentFolder, IRecentFile, IRecent, isRecentFolder, isRecentWorkspace, IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
import { URI } from 'vs/base/common/uri';
import { getIconClasses } from 'vs/editor/common/services/getIconClasses';
import { FileKind } from 'vs/platform/files/common/files';
@@ -45,7 +44,7 @@ abstract class BaseOpenRecentAction extends Action {
constructor(
id: string,
label: string,
private workspacesHistoryService: IWorkspacesHistoryService,
private workspacesService: IWorkspacesService,
private quickInputService: IQuickInputService,
private contextService: IWorkspaceContextService,
private labelService: ILabelService,
@@ -60,7 +59,7 @@ abstract class BaseOpenRecentAction extends Action {
protected abstract isQuickNavigate(): boolean;
async run(): Promise<void> {
const { workspaces, files } = await this.workspacesHistoryService.getRecentlyOpened();
const { workspaces, files } = await this.workspacesService.getRecentlyOpened();
this.openRecent(workspaces, files);
}
@@ -130,7 +129,7 @@ abstract class BaseOpenRecentAction extends Action {
onKeyMods: mods => keyMods = mods,
quickNavigate: this.isQuickNavigate() ? { keybindings: this.keybindingService.lookupKeybindings(this.id) } : undefined,
onDidTriggerItemButton: async context => {
await this.workspacesHistoryService.removeFromRecentlyOpened([context.item.resource]);
await this.workspacesService.removeFromRecentlyOpened([context.item.resource]);
context.removeItem();
}
});
@@ -149,7 +148,7 @@ export class OpenRecentAction extends BaseOpenRecentAction {
constructor(
id: string,
label: string,
@IWorkspacesHistoryService workspacesHistoryService: IWorkspacesHistoryService,
@IWorkspacesService workspacesService: IWorkspacesService,
@IQuickInputService quickInputService: IQuickInputService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
@IKeybindingService keybindingService: IKeybindingService,
@@ -158,7 +157,7 @@ export class OpenRecentAction extends BaseOpenRecentAction {
@ILabelService labelService: ILabelService,
@IHostService hostService: IHostService
) {
super(id, label, workspacesHistoryService, quickInputService, contextService, labelService, keybindingService, modelService, modeService, hostService);
super(id, label, workspacesService, quickInputService, contextService, labelService, keybindingService, modelService, modeService, hostService);
}
protected isQuickNavigate(): boolean {
@@ -174,7 +173,7 @@ class QuickOpenRecentAction extends BaseOpenRecentAction {
constructor(
id: string,
label: string,
@IWorkspacesHistoryService workspacesHistoryService: IWorkspacesHistoryService,
@IWorkspacesService workspacesService: IWorkspacesService,
@IQuickInputService quickInputService: IQuickInputService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
@IKeybindingService keybindingService: IKeybindingService,
@@ -183,7 +182,7 @@ class QuickOpenRecentAction extends BaseOpenRecentAction {
@ILabelService labelService: ILabelService,
@IHostService hostService: IHostService
) {
super(id, label, workspacesHistoryService, quickInputService, contextService, labelService, keybindingService, modelService, modeService, hostService);
super(id, label, workspacesService, quickInputService, contextService, labelService, keybindingService, modelService, modeService, hostService);
}
protected isQuickNavigate(): boolean {

View File

@@ -7,7 +7,7 @@ import { Action } from 'vs/base/common/actions';
import * as nls from 'vs/nls';
import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
import { IWorkspaceContextService, WorkbenchState, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
import { IWorkspaceEditingService } from 'vs/workbench/services/workspaces/common/workspaceEditing';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ICommandService, CommandsRegistry } from 'vs/platform/commands/common/commands';
import { ADD_ROOT_FOLDER_COMMAND_ID, ADD_ROOT_FOLDER_LABEL, PICK_WORKSPACE_FOLDER_COMMAND_ID } from 'vs/workbench/browser/actions/workspaceCommands';
@@ -200,7 +200,7 @@ const workspacesCategory = nls.localize('workspaces', "Workspaces");
registry.registerWorkbenchAction(new SyncActionDescriptor(AddRootFolderAction, AddRootFolderAction.ID, AddRootFolderAction.LABEL), 'Workspaces: Add Folder to Workspace...', workspacesCategory, SupportsWorkspacesContext);
registry.registerWorkbenchAction(new SyncActionDescriptor(GlobalRemoveRootFolderAction, GlobalRemoveRootFolderAction.ID, GlobalRemoveRootFolderAction.LABEL), 'Workspaces: Remove Folder from Workspace...', workspacesCategory, SupportsWorkspacesContext);
registry.registerWorkbenchAction(new SyncActionDescriptor(CloseWorkspaceAction, CloseWorkspaceAction.ID, CloseWorkspaceAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_F) }), 'File: Close Workspace', workspacesCategory, SupportsWorkspacesContext);
registry.registerWorkbenchAction(new SyncActionDescriptor(CloseWorkspaceAction, CloseWorkspaceAction.ID, CloseWorkspaceAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_F) }), 'Workspaces: Close Workspace', workspacesCategory, SupportsWorkspacesContext);
// --- Menu Registration

View File

@@ -5,7 +5,7 @@
import * as nls from 'vs/nls';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
import { IWorkspaceEditingService } from 'vs/workbench/services/workspaces/common/workspaceEditing';
import * as resources from 'vs/base/common/resources';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { CancellationToken } from 'vs/base/common/cancellation';

View File

@@ -3,12 +3,11 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { hasWorkspaceFileExtension, IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
import { hasWorkspaceFileExtension, IWorkspaceFolderCreationData, IRecentFile, IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
import { normalize } from 'vs/base/common/path';
import { basename } from 'vs/base/common/resources';
import { IFileService } from 'vs/platform/files/common/files';
import { IWindowOpenable } from 'vs/platform/windows/common/windows';
import { IWorkspacesHistoryService } from 'vs/workbench/services/workspace/common/workspacesHistoryService';
import { URI } from 'vs/base/common/uri';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
@@ -29,8 +28,7 @@ import { IEditorService, IResourceEditor } from 'vs/workbench/services/editor/co
import { Disposable } from 'vs/base/common/lifecycle';
import { addDisposableListener, EventType } from 'vs/base/browser/dom';
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IRecentFile } from 'vs/platform/workspaces/common/workspacesHistory';
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
import { IWorkspaceEditingService } from 'vs/workbench/services/workspaces/common/workspaceEditing';
import { withNullAsUndefined } from 'vs/base/common/types';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IHostService } from 'vs/workbench/services/host/browser/host';
@@ -162,7 +160,7 @@ export class ResourcesDropHandler {
constructor(
private options: IResourcesDropHandlerOptions,
@IFileService private readonly fileService: IFileService,
@IWorkspacesHistoryService private readonly workspacesHistoryService: IWorkspacesHistoryService,
@IWorkspacesService private readonly workspacesService: IWorkspacesService,
@ITextFileService private readonly textFileService: ITextFileService,
@IBackupFileService private readonly backupFileService: IBackupFileService,
@IUntitledEditorService private readonly untitledEditorService: IUntitledEditorService,
@@ -192,7 +190,7 @@ export class ResourcesDropHandler {
// Add external ones to recently open list unless dropped resource is a workspace
const recentFiles: IRecentFile[] = untitledOrFileResources.filter(d => d.isExternal && d.resource.scheme === Schemas.file).map(d => ({ fileUri: d.resource }));
if (recentFiles.length) {
this.workspacesHistoryService.addRecentlyOpened(recentFiles);
this.workspacesService.addRecentlyOpened(recentFiles);
}
const editors: IResourceEditor[] = untitledOrFileResources.map(untitledOrFileResource => ({

View File

@@ -16,12 +16,12 @@ import { IHistoryService } from 'vs/workbench/services/history/common/history';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
import { IWorkspacesHistoryService } from 'vs/workbench/services/workspace/common/workspacesHistoryService';
import { CLOSE_EDITOR_COMMAND_ID, NAVIGATE_ALL_EDITORS_GROUP_PREFIX, MOVE_ACTIVE_EDITOR_COMMAND_ID, NAVIGATE_IN_ACTIVE_GROUP_PREFIX, ActiveEditorMoveArguments, SPLIT_EDITOR_LEFT, SPLIT_EDITOR_RIGHT, SPLIT_EDITOR_UP, SPLIT_EDITOR_DOWN, splitEditor, LAYOUT_EDITOR_GROUPS_COMMAND_ID, mergeAllGroups } from 'vs/workbench/browser/parts/editor/editorCommands';
import { IEditorGroupsService, IEditorGroup, GroupsArrangement, EditorsOrder, GroupLocation, GroupDirection, preferredSideBySideGroupDirection, IFindGroupScope, GroupOrientation, EditorGroupLayout, GroupsOrder } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
export class ExecuteCommandAction extends Action {
@@ -1218,7 +1218,7 @@ export class ClearRecentFilesAction extends Action {
constructor(
id: string,
label: string,
@IWorkspacesHistoryService private readonly workspacesHistoryService: IWorkspacesHistoryService,
@IWorkspacesService private readonly workspacesService: IWorkspacesService,
@IHistoryService private readonly historyService: IHistoryService
) {
super(id, label);
@@ -1227,7 +1227,7 @@ export class ClearRecentFilesAction extends Action {
run(): Promise<any> {
// Clear global recently opened
this.workspacesHistoryService.clearRecentlyOpened();
this.workspacesService.clearRecentlyOpened();
// Clear workspace specific recently opened
this.historyService.clearRecentlyOpened();

View File

@@ -7,7 +7,6 @@ import * as nls from 'vs/nls';
import { IMenuService, MenuId, IMenu, SubmenuItemAction } from 'vs/platform/actions/common/actions';
import { registerThemingParticipant, ITheme, ICssStyleCollector, IThemeService } from 'vs/platform/theme/common/themeService';
import { MenuBarVisibility, getTitleBarStyle, IWindowOpenable } from 'vs/platform/windows/common/windows';
import { IWorkspacesHistoryService } from 'vs/workbench/services/workspace/common/workspacesHistoryService';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IAction, Action } from 'vs/base/common/actions';
import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
@@ -17,7 +16,7 @@ import { isMacintosh, isWeb } from 'vs/base/common/platform';
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
import { Event, Emitter } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { IRecentlyOpened, isRecentFolder, IRecent, isRecentWorkspace } from 'vs/platform/workspaces/common/workspacesHistory';
import { IRecentlyOpened, isRecentFolder, IRecent, isRecentWorkspace, IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
import { RunOnceScheduler } from 'vs/base/common/async';
import { MENUBAR_SELECTION_FOREGROUND, MENUBAR_SELECTION_BACKGROUND, MENUBAR_SELECTION_BORDER, TITLE_BAR_ACTIVE_FOREGROUND, TITLE_BAR_INACTIVE_FOREGROUND, ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_INACTIVE_FOREGROUND } from 'vs/workbench/common/theme';
import { URI } from 'vs/base/common/uri';
@@ -86,7 +85,7 @@ export abstract class MenubarControl extends Disposable {
constructor(
protected readonly menuService: IMenuService,
protected readonly workspacesHistoryService: IWorkspacesHistoryService,
protected readonly workspacesService: IWorkspacesService,
protected readonly contextKeyService: IContextKeyService,
protected readonly keybindingService: IKeybindingService,
protected readonly configurationService: IConfigurationService,
@@ -129,7 +128,7 @@ export abstract class MenubarControl extends Disposable {
this.updateService.onStateChange(() => this.updateMenubar());
// Listen for changes in recently opened menu
this._register(this.workspacesHistoryService.onRecentlyOpenedChange(() => { this.onRecentlyOpenedChange(); }));
this._register(this.workspacesService.onRecentlyOpenedChange(() => { this.onRecentlyOpenedChange(); }));
// Listen to keybindings change
this._register(this.keybindingService.onDidUpdateKeybindings(() => this.updateMenubar()));
@@ -191,7 +190,7 @@ export abstract class MenubarControl extends Disposable {
}
private onRecentlyOpenedChange(): void {
this.workspacesHistoryService.getRecentlyOpened().then(recentlyOpened => {
this.workspacesService.getRecentlyOpened().then(recentlyOpened => {
this.recentlyOpened = recentlyOpened;
this.updateMenubar();
});
@@ -271,7 +270,7 @@ export class CustomMenubarControl extends MenubarControl {
constructor(
@IMenuService menuService: IMenuService,
@IWorkspacesHistoryService workspacesHistoryService: IWorkspacesHistoryService,
@IWorkspacesService workspacesService: IWorkspacesService,
@IContextKeyService contextKeyService: IContextKeyService,
@IKeybindingService keybindingService: IKeybindingService,
@IConfigurationService configurationService: IConfigurationService,
@@ -291,7 +290,7 @@ export class CustomMenubarControl extends MenubarControl {
super(
menuService,
workspacesHistoryService,
workspacesService,
contextKeyService,
keybindingService,
configurationService,
@@ -308,7 +307,7 @@ export class CustomMenubarControl extends MenubarControl {
this._onVisibilityChange = this._register(new Emitter<boolean>());
this._onFocusStateChange = this._register(new Emitter<boolean>());
this.workspacesHistoryService.getRecentlyOpened().then((recentlyOpened) => {
this.workspacesService.getRecentlyOpened().then((recentlyOpened) => {
this.recentlyOpened = recentlyOpened;
});

View File

@@ -7,7 +7,9 @@ import 'vs/css!./media/style';
import { registerThemingParticipant, ITheme, ICssStyleCollector, HIGH_CONTRAST } from 'vs/platform/theme/common/themeService';
import { iconForeground, foreground, selectionBackground, focusBorder, scrollbarShadow, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, listHighlightForeground, inputPlaceholderForeground } from 'vs/platform/theme/common/colorRegistry';
import { WORKBENCH_BACKGROUND } from 'vs/workbench/common/theme';
import { WORKBENCH_BACKGROUND, TITLE_BAR_ACTIVE_BACKGROUND } from 'vs/workbench/common/theme';
import { isWeb } from 'vs/base/common/platform';
import { createMetaElement } from 'vs/base/browser/dom';
registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
@@ -143,4 +145,19 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
`);
}
// Update <meta name="theme-color" content=""> based on selected theme
if (isWeb) {
const titleBackground = theme.getColor(TITLE_BAR_ACTIVE_BACKGROUND);
if (titleBackground) {
const metaElementId = 'monaco-workbench-meta-theme-color';
let metaElement = document.getElementById(metaElementId) as HTMLMetaElement | null;
if (!metaElement) {
metaElement = createMetaElement();
metaElement.name = 'theme-color';
metaElement.id = metaElementId;
}
metaElement.content = titleBackground.toString();
}
}
});

View File

@@ -33,7 +33,7 @@ import { ConfigurationCache } from 'vs/workbench/services/configuration/browser/
import { ISignService } from 'vs/platform/sign/common/sign';
import { SignService } from 'vs/platform/sign/browser/signService';
import { hash } from 'vs/base/common/hash';
import { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api';
import { IWorkbenchConstructionOptions, IWorkspace } from 'vs/workbench/workbench.web.api';
import { FileUserDataProvider } from 'vs/workbench/services/userData/common/fileUserDataProvider';
import { BACKUPS } from 'vs/platform/environment/common/environment';
import { joinPath } from 'vs/base/common/resources';
@@ -47,6 +47,7 @@ import { FileLogService } from 'vs/platform/log/common/fileLogService';
import { toLocalISOString } from 'vs/base/common/date';
import { IndexedDBLogProvider } from 'vs/workbench/services/log/browser/indexedDBLogProvider';
import { InMemoryLogProvider } from 'vs/workbench/services/log/common/inMemoryLogProvider';
import { isWorkspaceToOpen, isFolderToOpen } from 'vs/platform/windows/common/windows';
class BrowserMain extends Disposable {
@@ -284,15 +285,27 @@ class BrowserMain extends Disposable {
}
private resolveWorkspaceInitializationPayload(): IWorkspaceInitializationPayload {
let workspace: IWorkspace | undefined = undefined;
if (this.configuration.workspaceProvider) {
workspace = this.configuration.workspaceProvider.workspace;
} else {
// TODO@ben remove me once IWorkspaceProvider API is adopted
const legacyConfiguration = this.configuration as { workspaceUri?: URI, folderUri?: URI };
if (legacyConfiguration.workspaceUri) {
workspace = { workspaceUri: legacyConfiguration.workspaceUri };
} else if (legacyConfiguration.folderUri) {
workspace = { folderUri: legacyConfiguration.folderUri };
}
}
// Multi-root workspace
if (this.configuration.workspaceUri) {
return { id: hash(this.configuration.workspaceUri.toString()).toString(16), configPath: this.configuration.workspaceUri };
if (workspace && isWorkspaceToOpen(workspace)) {
return { id: hash(workspace.workspaceUri.toString()).toString(16), configPath: workspace.workspaceUri };
}
// Single-folder workspace
if (this.configuration.folderUri) {
return { id: hash(this.configuration.folderUri.toString()).toString(16), folder: this.configuration.folderUri };
if (workspace && isFolderToOpen(workspace)) {
return { id: hash(workspace.folderUri.toString()).toString(16), folder: workspace.folderUri };
}
return { id: 'empty-window' };