Skip to content

Commit b3a649f

Browse files
authored
Remove cycle browserHostService.ts -> web.api.ts. (#198221)
* Remove cycle browserHostService.ts -> web.api.ts. Before this change, `IWorkbenchConstructionOptions` in web.api.ts depended on `IWorkspaceProvider` in browserHostService.ts, which depends on some types from web.api.ts. While this apparently does not pose problems in VS Code's build, other build system of downstream projects do not allow this, and it is also overall harder to follow the code if "the API" depends on types defined in ""the implementation". * Fix one reference I missed
1 parent 0bc6184 commit b3a649f

File tree

5 files changed

+47
-47
lines changed

5 files changed

+47
-47
lines changed

src/vs/code/browser/workbench/workbench.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ import { URI, UriComponents } from 'vs/base/common/uri';
1717
import product from 'vs/platform/product/common/product';
1818
import { ISecretStorageProvider } from 'vs/platform/secrets/common/secrets';
1919
import { isFolderToOpen, isWorkspaceToOpen } from 'vs/platform/window/common/window';
20-
import type { IWorkbenchConstructionOptions } from 'vs/workbench/browser/web.api';
20+
import type { IWorkbenchConstructionOptions, IWorkspace, IWorkspaceProvider } from 'vs/workbench/browser/web.api';
2121
import { AuthenticationSessionInfo } from 'vs/workbench/services/authentication/browser/authenticationService';
22-
import type { IWorkspace, IWorkspaceProvider } from 'vs/workbench/services/host/browser/browserHostService';
2322
import type { IURLCallbackProvider } from 'vs/workbench/services/url/browser/urlService';
2423
import { create } from 'vs/workbench/workbench.web.main';
2524

src/vs/workbench/browser/web.api.ts

+42-1
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import type { IURLCallbackProvider } from 'vs/workbench/services/url/browser/url
1010
import type { LogLevel } from 'vs/platform/log/common/log';
1111
import type { IUpdateProvider } from 'vs/workbench/services/update/browser/updateService';
1212
import type { Event } from 'vs/base/common/event';
13-
import type { IWorkspaceProvider } from 'vs/workbench/services/host/browser/browserHostService';
1413
import type { IProductConfiguration } from 'vs/base/common/product';
1514
import type { ISecretStorageProvider } from 'vs/platform/secrets/common/secrets';
1615
import type { TunnelProviderFeatures } from 'vs/platform/tunnel/common/tunnel';
1716
import type { IProgress, IProgressCompositeOptions, IProgressDialogOptions, IProgressNotificationOptions, IProgressOptions, IProgressStep, IProgressWindowOptions } from 'vs/platform/progress/common/progress';
1817
import type { ITextEditorOptions } from 'vs/platform/editor/common/editor';
18+
import type { IFolderToOpen, IWorkspaceToOpen } from 'vs/platform/window/common/window';
1919
import type { EditorGroupLayout } from 'vs/workbench/services/editor/common/editorGroupsService';
2020
import type { IEmbedderTerminalOptions } from 'vs/workbench/services/terminal/common/embedderTerminalService';
2121

@@ -363,6 +363,47 @@ export interface IWorkbenchConstructionOptions {
363363

364364
}
365365

366+
367+
/**
368+
* A workspace to open in the workbench can either be:
369+
* - a workspace file with 0-N folders (via `workspaceUri`)
370+
* - a single folder (via `folderUri`)
371+
* - empty (via `undefined`)
372+
*/
373+
export type IWorkspace = IWorkspaceToOpen | IFolderToOpen | undefined;
374+
375+
export interface IWorkspaceProvider {
376+
377+
/**
378+
* The initial workspace to open.
379+
*/
380+
readonly workspace: IWorkspace;
381+
382+
/**
383+
* Arbitrary payload from the `IWorkspaceProvider.open` call.
384+
*/
385+
readonly payload?: object;
386+
387+
/**
388+
* Return `true` if the provided [workspace](#IWorkspaceProvider.workspace) is trusted, `false` if not trusted, `undefined` if unknown.
389+
*/
390+
readonly trusted: boolean | undefined;
391+
392+
/**
393+
* Asks to open a workspace in the current or a new window.
394+
*
395+
* @param workspace the workspace to open.
396+
* @param options optional options for the workspace to open.
397+
* - `reuse`: whether to open inside the current window or a new window
398+
* - `payload`: arbitrary payload that should be made available
399+
* to the opening window via the `IWorkspaceProvider.payload` property.
400+
* @param payload optional payload to send to the workspace to open.
401+
*
402+
* @returns true if successfully opened, false otherwise.
403+
*/
404+
open(workspace: IWorkspace, options?: { reuse?: boolean; payload?: object }): Promise<boolean>;
405+
}
406+
366407
export interface IResourceUriProvider {
367408
(uri: URI): URI;
368409
}

src/vs/workbench/browser/web.main.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { WorkspaceService } from 'vs/workbench/services/configuration/browser/co
3232
import { ConfigurationCache } from 'vs/workbench/services/configuration/common/configurationCache';
3333
import { ISignService } from 'vs/platform/sign/common/sign';
3434
import { SignService } from 'vs/platform/sign/browser/signService';
35-
import { IWorkbenchConstructionOptions, IWorkbench, ITunnel } from 'vs/workbench/browser/web.api';
35+
import { IWorkbenchConstructionOptions, IWorkbench, IWorkspace, ITunnel } from 'vs/workbench/browser/web.api';
3636
import { BrowserStorageService } from 'vs/workbench/services/storage/browser/storageService';
3737
import { IStorageService } from 'vs/platform/storage/common/storage';
3838
import { toLocalISOString } from 'vs/base/common/date';
@@ -63,7 +63,6 @@ import { HTMLFileSystemProvider } from 'vs/platform/files/browser/htmlFileSystem
6363
import { IOpenerService } from 'vs/platform/opener/common/opener';
6464
import { mixin, safeStringify } from 'vs/base/common/objects';
6565
import { IndexedDB } from 'vs/base/browser/indexedDB';
66-
import { IWorkspace } from 'vs/workbench/services/host/browser/browserHostService';
6766
import { WebFileSystemAccess } from 'vs/platform/files/browser/webFileSystemAccess';
6867
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
6968
import { IProgressService } from 'vs/platform/progress/common/progress';

src/vs/workbench/contrib/debug/browser/extensionHostDebugService.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import { ILogService } from 'vs/platform/log/common/log';
1414
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
1515
import { isFolderToOpen, isWorkspaceToOpen } from 'vs/platform/window/common/window';
1616
import { IWorkspaceContextService, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, toWorkspaceIdentifier, hasWorkspaceFileExtension } from 'vs/platform/workspace/common/workspace';
17+
import { IWorkspace, IWorkspaceProvider } from 'vs/workbench/browser/web.api';
1718
import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService';
18-
import { IWorkspace, IWorkspaceProvider } from 'vs/workbench/services/host/browser/browserHostService';
1919
import { IHostService } from 'vs/workbench/services/host/browser/host';
2020
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
2121

src/vs/workbench/services/host/browser/browserHostService.ts

+2-41
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/
99
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
1010
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
1111
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
12-
import { IWindowSettings, IWindowOpenable, IOpenWindowOptions, isFolderToOpen, isWorkspaceToOpen, isFileToOpen, IOpenEmptyWindowOptions, IPathData, IFileToOpen, IWorkspaceToOpen, IFolderToOpen, IPoint } from 'vs/platform/window/common/window';
12+
import { IWindowSettings, IWindowOpenable, IOpenWindowOptions, isFolderToOpen, isWorkspaceToOpen, isFileToOpen, IOpenEmptyWindowOptions, IPathData, IFileToOpen, IPoint } from 'vs/platform/window/common/window';
1313
import { isResourceEditorInput, pathsToEditors } from 'vs/workbench/common/editor';
1414
import { whenEditorClosed } from 'vs/workbench/browser/editor';
15+
import { IWorkspace, IWorkspaceProvider } from 'vs/workbench/browser/web.api';
1516
import { IFileService } from 'vs/platform/files/common/files';
1617
import { ILabelService, Verbosity } from 'vs/platform/label/common/label';
1718
import { ModifierKeyEmitter, disposableWindowInterval, getActiveDocument, getWindowId, onDidRegisterWindow, trackFocus } from 'vs/base/browser/dom';
@@ -39,46 +40,6 @@ import { IUserDataProfileService } from 'vs/workbench/services/userDataProfile/c
3940
import { coalesce } from 'vs/base/common/arrays';
4041
import { mainWindow, isAuxiliaryWindow } from 'vs/base/browser/window';
4142

42-
/**
43-
* A workspace to open in the workbench can either be:
44-
* - a workspace file with 0-N folders (via `workspaceUri`)
45-
* - a single folder (via `folderUri`)
46-
* - empty (via `undefined`)
47-
*/
48-
export type IWorkspace = IWorkspaceToOpen | IFolderToOpen | undefined;
49-
50-
export interface IWorkspaceProvider {
51-
52-
/**
53-
* The initial workspace to open.
54-
*/
55-
readonly workspace: IWorkspace;
56-
57-
/**
58-
* Arbitrary payload from the `IWorkspaceProvider.open` call.
59-
*/
60-
readonly payload?: object;
61-
62-
/**
63-
* Return `true` if the provided [workspace](#IWorkspaceProvider.workspace) is trusted, `false` if not trusted, `undefined` if unknown.
64-
*/
65-
readonly trusted: boolean | undefined;
66-
67-
/**
68-
* Asks to open a workspace in the current or a new window.
69-
*
70-
* @param workspace the workspace to open.
71-
* @param options optional options for the workspace to open.
72-
* - `reuse`: whether to open inside the current window or a new window
73-
* - `payload`: arbitrary payload that should be made available
74-
* to the opening window via the `IWorkspaceProvider.payload` property.
75-
* @param payload optional payload to send to the workspace to open.
76-
*
77-
* @returns true if successfully opened, false otherwise.
78-
*/
79-
open(workspace: IWorkspace, options?: { reuse?: boolean; payload?: object }): Promise<boolean>;
80-
}
81-
8243
enum HostShutdownReason {
8344

8445
/**

0 commit comments

Comments
 (0)