workbench.web.api.ts 4.0 KB
Newer Older
B
Benjamin Pasero 已提交
1 2 3 4 5 6 7
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

import 'vs/workbench/workbench.web.main';
import { main } from 'vs/workbench/browser/web.main';
A
Alex Dima 已提交
8
import { UriComponents, URI } from 'vs/base/common/uri';
B
Benjamin Pasero 已提交
9 10
import { IFileSystemProvider, FileSystemProviderCapabilities, IFileChange, FileChangeType } from 'vs/platform/files/common/files';
import { IWebSocketFactory, IWebSocket } from 'vs/platform/remote/browser/browserSocketFactory';
11
import { ICredentialsProvider } from 'vs/workbench/services/credentials/browser/credentialsService';
12
import { IExtensionManifest } from 'vs/platform/extensions/common/extensions';
13
import { IURLCallbackProvider } from 'vs/workbench/services/url/browser/urlService';
14
import { LogLevel } from 'vs/platform/log/common/log';
B
Benjamin Pasero 已提交
15 16 17
import { IUpdateProvider, IUpdate } from 'vs/workbench/services/update/browser/updateService';
import { Event, Emitter } from 'vs/base/common/event';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
B
Benjamin Pasero 已提交
18

B
Benjamin Pasero 已提交
19
interface IWorkbenchConstructionOptions {
B
Benjamin Pasero 已提交
20 21 22 23 24

	/**
	 * Experimental: the remote authority is the IP:PORT from where the workbench is served
	 * from. It is for example being used for the websocket connections as address.
	 */
25
	remoteAuthority?: string;
B
Benjamin Pasero 已提交
26

A
Alex Dima 已提交
27 28 29 30 31
	/**
	 * The connection token to send to the server.
	 */
	connectionToken?: string;

B
Benjamin Pasero 已提交
32 33 34 35
	/**
	 * Experimental: An endpoint to serve iframe content ("webview") from. This is required
	 * to provide full security isolation from the workbench host.
	 */
B
Benjamin Pasero 已提交
36 37
	webviewEndpoint?: string;

B
Benjamin Pasero 已提交
38 39 40
	/**
	 * Experimental: An optional folder that is set as workspace context for the workbench.
	 */
41
	folderUri?: URI;
B
Benjamin Pasero 已提交
42 43 44 45

	/**
	 * Experimental: An optional workspace that is set as workspace context for the workbench.
	 */
46
	workspaceUri?: URI;
47

B
Benjamin Pasero 已提交
48 49 50 51
	/**
	 * Experimental: The userDataProvider is used to handle user specific application
	 * state like settings, keybindings, UI state (e.g. opened editors) and snippets.
	 */
S
Sandeep Somavarapu 已提交
52
	userDataProvider?: IFileSystemProvider;
53

A
Alex Dima 已提交
54 55 56 57
	/**
	 * A factory for web sockets.
	 */
	webSocketFactory?: IWebSocketFactory;
58

A
Alex Dima 已提交
59 60 61
	/**
	 * A provider for resource URIs.
	 */
62
	resourceUriProvider?: (uri: URI) => URI;
A
Alex Dima 已提交
63

64 65 66 67
	/**
	 * Experimental: Whether to enable the smoke test driver.
	 */
	driver?: boolean;
68 69 70 71 72

	/**
	 * Experimental: The credentials provider to store and retrieve secrets.
	 */
	credentialsProvider?: ICredentialsProvider;
73 74 75 76

	/**
	 * Experimental: Add static extensions that cannot be uninstalled but only be disabled.
	 */
77
	staticExtensions?: { packageJSON: IExtensionManifest, extensionLocation: URI }[];
78 79 80 81 82

	/**
	 * Experimental: Support for URL callbacks.
	 */
	urlCallbackProvider?: IURLCallbackProvider;
83

84 85 86 87
	/**
	 * Current logging level. Default is `LogLevel.Info`.
	 */
	logLevel?: LogLevel;
88 89 90 91 92

	/**
	 * Experimental: Support for update reporting.
	 */
	updateProvider?: IUpdateProvider;
93 94 95 96 97

	/**
	 * Experimental: Resolves an external uri before it is opened.
	 */
	readonly resolveExternalUri?: (uri: URI) => Promise<URI>;
B
Benjamin Pasero 已提交
98 99
}

B
Benjamin Pasero 已提交
100 101 102 103 104 105
/**
 * Experimental: Creates the workbench with the provided options in the provided container.
 *
 * @param domElement the container to create the workbench in
 * @param options for setting up the workbench
 */
B
Benjamin Pasero 已提交
106 107 108 109
function create(domElement: HTMLElement, options: IWorkbenchConstructionOptions): Promise<void> {
	return main(domElement, options);
}

B
Benjamin Pasero 已提交
110
export {
B
Benjamin Pasero 已提交
111 112 113 114 115 116 117

	// Factory
	create,
	IWorkbenchConstructionOptions,

	// Basic Types
	URI,
118
	UriComponents,
B
Benjamin Pasero 已提交
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
	Event,
	Emitter,
	IDisposable,
	Disposable,

	// FileSystem
	IFileSystemProvider,
	FileSystemProviderCapabilities,
	IFileChange,
	FileChangeType,

	// WebSockets
	IWebSocketFactory,
	IWebSocket,

	// Credentials
	ICredentialsProvider,

	// Static Extensions
	IExtensionManifest,

	// Callbacks
	IURLCallbackProvider,

	// LogLevel
	LogLevel,

	// Updates
	IUpdateProvider,
	IUpdate
A
Alex Dima 已提交
149
};