2019-07-23 05:00:59 +08:00
diff --git a/src/vs/base/common/network.ts b/src/vs/base/common/network.ts
2020-02-13 04:09:52 +08:00
index a68e020f9f..b4ee8a5886 100644
2019-07-23 05:00:59 +08:00
--- a/src/vs/base/common/network.ts
+++ b/src/vs/base/common/network.ts
2020-02-13 04:09:52 +08:00
@@ -88,7 +88,7 @@ class RemoteAuthoritiesImpl {
2019-10-19 07:20:02 +08:00
if (host && host.indexOf(':') !== -1) {
host = `[${host}]`;
}
2019-08-30 08:05:48 +08:00
- const port = this._ports[authority];
2019-12-17 06:52:29 +08:00
+ // const port = this._ports[authority];
2019-08-30 08:05:48 +08:00
const connectionToken = this._connectionTokens[authority];
2019-12-17 06:52:29 +08:00
let query = `path=${encodeURIComponent(uri.path)}`;
if (typeof connectionToken === 'string') {
2020-02-13 04:09:52 +08:00
@@ -96,8 +96,8 @@ class RemoteAuthoritiesImpl {
2019-12-17 06:52:29 +08:00
}
2019-08-30 08:05:48 +08:00
return URI.from({
scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,
- authority: `${host}:${port}`,
- path: `/vscode-remote-resource`,
+ authority: window.location.host,
+ path: `${window.location.pathname.replace(/\/+$/, '')}/vscode-remote-resource`,
2019-12-17 06:52:29 +08:00
query
2019-08-30 08:05:48 +08:00
});
}
2019-08-03 08:26:41 +08:00
diff --git a/src/vs/base/common/platform.ts b/src/vs/base/common/platform.ts
2019-12-17 06:52:29 +08:00
index 5a631e0b39..8a2b1518d6 100644
2019-08-03 08:26:41 +08:00
--- a/src/vs/base/common/platform.ts
+++ b/src/vs/base/common/platform.ts
2019-12-17 06:52:29 +08:00
@@ -59,6 +59,17 @@ if (typeof navigator === 'object' && !isElectronRenderer) {
2019-08-03 08:26:41 +08:00
_isWeb = true;
2019-10-19 07:20:02 +08:00
_locale = navigator.language;
_language = _locale;
2019-12-17 06:52:29 +08:00
+ // NOTE@coder: make languages work.
2019-10-19 07:20:02 +08:00
+ const el = typeof document !== 'undefined' && document.getElementById('vscode-remote-nls-configuration');
+ const rawNlsConfig = el && el.getAttribute('data-settings');
2019-08-03 08:26:41 +08:00
+ if (rawNlsConfig) {
+ try {
+ const nlsConfig: NLSConfig = JSON.parse(rawNlsConfig);
+ _locale = nlsConfig.locale;
+ _translationsConfigFile = nlsConfig._translationsConfigFile;
+ _language = nlsConfig.availableLanguages['*'] || LANGUAGE_DEFAULT;
+ } catch (error) { /* Oh well. */ }
+ }
} else if (typeof process === 'object') {
_isWindows = (process.platform === 'win32');
_isMacintosh = (process.platform === 'darwin');
2019-10-29 05:08:32 +08:00
diff --git a/src/vs/base/common/processes.ts b/src/vs/base/common/processes.ts
2019-12-17 06:52:29 +08:00
index c52f7b3774..5a7e7f579e 100644
2019-10-29 05:08:32 +08:00
--- a/src/vs/base/common/processes.ts
+++ b/src/vs/base/common/processes.ts
2019-12-17 06:52:29 +08:00
@@ -110,7 +110,10 @@ export function sanitizeProcessEnvironment(env: IProcessEnvironment, ...preserve
2019-10-29 05:08:32 +08:00
/^ELECTRON_.+$/,
/^GOOGLE_API_KEY$/,
/^VSCODE_.+$/,
- /^SNAP(|_.*)$/
+ /^SNAP(|_.*)$/,
2019-12-17 06:52:29 +08:00
+ // NOTE@coder: add our own environment variables.
2019-10-29 05:08:32 +08:00
+ /^NBIN_BYPASS$/,
+ /^LAUNCH_VSCODE$/
];
const envKeys = Object.keys(env);
envKeys
2019-09-20 03:41:17 +08:00
diff --git a/src/vs/base/node/languagePacks.js b/src/vs/base/node/languagePacks.js
2019-12-17 06:52:29 +08:00
index 2c64061da7..c0ef8faedd 100644
2019-09-20 03:41:17 +08:00
--- a/src/vs/base/node/languagePacks.js
+++ b/src/vs/base/node/languagePacks.js
2019-12-17 06:52:29 +08:00
@@ -128,7 +128,10 @@ function factory(nodeRequire, path, fs, perf) {
2019-09-20 03:41:17 +08:00
function getLanguagePackConfigurations(userDataPath) {
const configFile = path.join(userDataPath, 'languagepacks.json');
try {
- return nodeRequire(configFile);
2019-10-19 07:20:02 +08:00
+ // NOTE@coder: Swapped require with readFile since require is cached and
+ // we don't restart the server-side portion of code-server when the
+ // language changes.
2019-09-20 03:41:17 +08:00
+ return JSON.parse(fs.readFileSync(configFile, "utf8"));
} catch (err) {
// Do nothing. If we can't read the file we have no
// language pack config.
2020-02-13 06:49:34 +08:00
diff --git a/src/vs/code/browser/workbench/workbench.ts b/src/vs/code/browser/workbench/workbench.ts
index a599f5a7eb..ec7ccd43f8 100644
--- a/src/vs/code/browser/workbench/workbench.ts
+++ b/src/vs/code/browser/workbench/workbench.ts
@@ -298,35 +298,6 @@ class WorkspaceProvider implements IWorkspaceProvider {
let workspace: IWorkspace;
let payload = Object.create(null);
- const query = new URL(document.location.href).searchParams;
- query.forEach((value, key) => {
- switch (key) {
-
- // Folder
- case WorkspaceProvider.QUERY_PARAM_FOLDER:
- workspace = { folderUri: URI.parse(value) };
- foundWorkspace = true;
- break;
-
- // Workspace
- case WorkspaceProvider.QUERY_PARAM_WORKSPACE:
- workspace = { workspaceUri: URI.parse(value) };
- foundWorkspace = true;
- break;
-
- // Empty
- case WorkspaceProvider.QUERY_PARAM_EMPTY_WINDOW:
- workspace = undefined;
- foundWorkspace = true;
- break;
-
- // Payload
- case WorkspaceProvider.QUERY_PARAM_PAYLOAD:
- payload = JSON.parse(value);
- break;
- }
- });
-
// If no workspace is provided through the URL, check for config attribute from server
if (!foundWorkspace) {
if (config.folderUri) {
2019-07-13 05:39:38 +08:00
diff --git a/src/vs/platform/environment/common/environment.ts b/src/vs/platform/environment/common/environment.ts
2020-02-13 04:09:52 +08:00
index abd1e33b18..bf75952ce1 100644
2019-07-13 05:39:38 +08:00
--- a/src/vs/platform/environment/common/environment.ts
+++ b/src/vs/platform/environment/common/environment.ts
2019-12-17 06:52:29 +08:00
@@ -37,6 +37,8 @@ export interface ParsedArgs {
2019-10-19 07:20:02 +08:00
logExtensionHostCommunication?: boolean;
'extensions-dir'?: string;
'builtin-extensions-dir'?: string;
+ 'extra-extensions-dir'?: string[];
+ 'extra-builtin-extensions-dir'?: string[];
extensionDevelopmentPath?: string[]; // // undefined or array of 1 or more local paths or URIs
extensionTestsPath?: string; // either a local path or a URI
'extension-development-confirm-save'?: boolean;
2020-02-13 04:09:52 +08:00
@@ -147,6 +149,8 @@ export interface IEnvironmentService extends IUserHomeProvider {
2019-12-17 06:52:29 +08:00
disableExtensions: boolean | string[];
builtinExtensionsPath: string;
extensionsPath?: string;
2019-07-13 05:39:38 +08:00
+ extraExtensionPaths: string[];
+ extraBuiltinExtensionPaths: string[];
2019-12-17 06:52:29 +08:00
extensionDevelopmentLocationURI?: URI[];
extensionTestsLocationURI?: URI;
logExtensionHostCommunication?: boolean;
2019-10-19 07:20:02 +08:00
diff --git a/src/vs/platform/environment/node/argv.ts b/src/vs/platform/environment/node/argv.ts
2020-02-13 04:09:52 +08:00
index e68e0647c3..49a5aae2fa 100644
2019-10-19 07:20:02 +08:00
--- a/src/vs/platform/environment/node/argv.ts
+++ b/src/vs/platform/environment/node/argv.ts
2019-12-17 06:52:29 +08:00
@@ -55,6 +55,8 @@ export const OPTIONS: OptionDescriptions<Required<ParsedArgs>> = {
2019-10-19 07:20:02 +08:00
'extensions-dir': { type: 'string', deprecates: 'extensionHomePath', cat: 'e', args: 'dir', description: localize('extensionHomePath', "Set the root path for extensions.") },
'builtin-extensions-dir': { type: 'string' },
+ 'extra-builtin-extensions-dir': { type: 'string[]', cat: 'o', description: 'Path to an extra builtin extension directory.' },
+ 'extra-extensions-dir': { type: 'string[]', cat: 'o', description: 'Path to an extra user extension directory.' },
'list-extensions': { type: 'boolean', cat: 'e', description: localize('listExtensions', "List the installed extensions.") },
'show-versions': { type: 'boolean', cat: 'e', description: localize('showVersions', "Show versions of installed extensions, when using --list-extension.") },
'category': { type: 'string', cat: 'e', description: localize('category', "Filters installed extensions by provided category, when using --list-extension.") },
2020-02-13 04:09:52 +08:00
@@ -310,4 +312,3 @@ export function buildHelpMessage(productName: string, executableName: string, ve
2019-12-17 06:52:29 +08:00
export function buildVersionMessage(version: string | undefined, commit: string | undefined): string {
return `${version || localize('unknownVersion', "Unknown version")}\n${commit || localize('unknownCommit', "Unknown commit")}\n${process.arch}`;
}
-
2019-07-13 05:39:38 +08:00
diff --git a/src/vs/platform/environment/node/environmentService.ts b/src/vs/platform/environment/node/environmentService.ts
2020-02-13 04:09:52 +08:00
index 0428e1e888..9b3cddcb3a 100644
2019-07-13 05:39:38 +08:00
--- a/src/vs/platform/environment/node/environmentService.ts
+++ b/src/vs/platform/environment/node/environmentService.ts
2020-02-13 04:09:52 +08:00
@@ -197,6 +197,13 @@ export class EnvironmentService implements IEnvironmentService {
return path.join(this.userHome, product.dataFolderName, 'extensions');
}
2019-07-13 05:39:38 +08:00
2019-08-10 07:50:05 +08:00
+ @memoize get extraExtensionPaths(): string[] {
2019-10-19 07:20:02 +08:00
+ return (this._args['extra-extensions-dir'] || []).map((p) => <string>parsePathArg(p, process));
2019-07-13 05:39:38 +08:00
+ }
2019-08-10 07:50:05 +08:00
+ @memoize get extraBuiltinExtensionPaths(): string[] {
2019-10-19 07:20:02 +08:00
+ return (this._args['extra-builtin-extensions-dir'] || []).map((p) => <string>parsePathArg(p, process));
2019-08-10 07:50:05 +08:00
+ }
2020-02-13 04:09:52 +08:00
+
@memoize
get extensionDevelopmentLocationURI(): URI[] | undefined {
const s = this._args.extensionDevelopmentPath;
2019-07-13 05:39:38 +08:00
diff --git a/src/vs/platform/extensionManagement/node/extensionManagementService.ts b/src/vs/platform/extensionManagement/node/extensionManagementService.ts
2020-02-13 04:09:52 +08:00
index 5b05650591..dc5140410e 100644
2019-07-13 05:39:38 +08:00
--- a/src/vs/platform/extensionManagement/node/extensionManagementService.ts
+++ b/src/vs/platform/extensionManagement/node/extensionManagementService.ts
2020-02-13 04:09:52 +08:00
@@ -743,11 +743,15 @@ export class ExtensionManagementService extends Disposable implements IExtension
2019-07-13 05:39:38 +08:00
private scanSystemExtensions(): Promise<ILocalExtension[]> {
this.logService.trace('Started scanning system extensions');
- const systemExtensionsPromise = this.scanExtensions(this.systemExtensionsPath, ExtensionType.System)
- .then(result => {
- this.logService.trace('Scanned system extensions:', result.length);
- return result;
- });
+ const systemExtensionsPromise = Promise.all([
+ this.scanExtensions(this.systemExtensionsPath, ExtensionType.System),
+ ...this.environmentService.extraBuiltinExtensionPaths
+ .map((path) => this.scanExtensions(path, ExtensionType.System))
+ ]).then((results) => {
+ const result = results.reduce((flat, current) => flat.concat(current), []);
2019-10-19 07:20:02 +08:00
+ this.logService.trace('Scanned system extensions:', result.length);
2019-07-13 05:39:38 +08:00
+ return result;
+ });
if (this.environmentService.isBuilt) {
return systemExtensionsPromise;
}
2020-02-13 04:09:52 +08:00
@@ -769,9 +773,17 @@ export class ExtensionManagementService extends Disposable implements IExtension
2019-07-13 05:39:38 +08:00
.then(([systemExtensions, devSystemExtensions]) => [...systemExtensions, ...devSystemExtensions]);
}
+ private scanAllUserExtensions(folderName: string, type: ExtensionType): Promise<ILocalExtension[]> {
+ return Promise.all([
+ this.scanExtensions(folderName, type),
+ ...this.environmentService.extraExtensionPaths.map((p) => this.scanExtensions(p, ExtensionType.User))
+ ]).then((results) => results.reduce((flat, current) => flat.concat(current), []));
+ }
2020-02-13 04:09:52 +08:00
+
2019-07-13 05:39:38 +08:00
+
private scanUserExtensions(excludeOutdated: boolean): Promise<ILocalExtension[]> {
this.logService.trace('Started scanning user extensions');
- return Promise.all([this.getUninstalledExtensions(), this.scanExtensions(this.extensionsPath, ExtensionType.User)])
+ return Promise.all([this.getUninstalledExtensions(), this.scanAllUserExtensions(this.extensionsPath, ExtensionType.User)])
.then(([uninstalled, extensions]) => {
extensions = extensions.filter(e => !uninstalled[new ExtensionIdentifierWithVersion(e.identifier, e.manifest.version).key()]);
if (excludeOutdated) {
2020-02-13 04:09:52 +08:00
@@ -786,6 +798,12 @@ export class ExtensionManagementService extends Disposable implements IExtension
2019-08-21 08:16:44 +08:00
private scanExtensions(root: string, type: ExtensionType): Promise<ILocalExtension[]> {
const limiter = new Limiter<any>(10);
return pfs.readdir(root)
+ .catch((error) => {
+ if (error.code !== 'ENOENT') {
+ throw error;
+ }
2020-02-13 04:09:52 +08:00
+ return <string[]>[];
2019-08-21 08:16:44 +08:00
+ })
.then(extensionsFolders => Promise.all<ILocalExtension>(extensionsFolders.map(extensionFolder => limiter.queue(() => this.scanExtension(extensionFolder, root, type)))))
.then(extensions => extensions.filter(e => e && e.identifier));
}
2020-02-13 04:09:52 +08:00
@@ -824,7 +842,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
2019-07-13 05:39:38 +08:00
private async removeUninstalledExtensions(): Promise<void> {
const uninstalled = await this.getUninstalledExtensions();
- const extensions = await this.scanExtensions(this.extensionsPath, ExtensionType.User); // All user extensions
+ const extensions = await this.scanAllUserExtensions(this.extensionsPath, ExtensionType.User); // All user extensions
const installed: Set<string> = new Set<string>();
for (const e of extensions) {
if (!uninstalled[new ExtensionIdentifierWithVersion(e.identifier, e.manifest.version).key()]) {
2020-02-13 04:09:52 +08:00
@@ -843,7 +861,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
2019-07-13 05:39:38 +08:00
}
private removeOutdatedExtensions(): Promise<void> {
- return this.scanExtensions(this.extensionsPath, ExtensionType.User) // All user extensions
+ return this.scanAllUserExtensions(this.extensionsPath, ExtensionType.User) // All user extensions
.then(extensions => {
const toRemove: ILocalExtension[] = [];
2019-10-19 07:20:02 +08:00
diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts
2019-12-17 06:52:29 +08:00
index 804d113856..4b651e5c77 100644
2019-10-19 07:20:02 +08:00
--- a/src/vs/platform/product/common/product.ts
+++ b/src/vs/platform/product/common/product.ts
2019-12-17 06:52:29 +08:00
@@ -22,11 +22,19 @@ if (isWeb) {
2019-10-19 07:20:02 +08:00
if (Object.keys(product).length === 0) {
assign(product, {
2019-12-17 06:52:29 +08:00
version: '1.41.0-dev',
2019-10-19 07:20:02 +08:00
+ codeServerVersion: 'dev',
nameLong: 'Visual Studio Code Web Dev',
2019-12-17 06:52:29 +08:00
nameShort: 'VSCode Web Dev',
urlProtocol: 'code-oss'
2019-10-19 07:20:02 +08:00
});
2019-08-03 08:26:41 +08:00
}
2019-12-17 06:52:29 +08:00
+
+ // NOTE@coder: enable injecting settings from the server.
2019-10-19 07:20:02 +08:00
+ const el = document.getElementById('vscode-remote-product-configuration');
+ const rawProductConfiguration = el && el.getAttribute('data-settings');
+ if (rawProductConfiguration) {
+ assign(product, JSON.parse(rawProductConfiguration));
+ }
}
2019-08-03 08:26:41 +08:00
2019-10-19 07:20:02 +08:00
// Node: AMD loader
2019-12-17 06:52:29 +08:00
@@ -36,7 +44,7 @@ else if (typeof require !== 'undefined' && typeof require.__$__nodeRequire === '
2019-10-19 07:20:02 +08:00
const rootPath = path.dirname(getPathFromAmdModule(require, ''));
product = assign({}, require.__$__nodeRequire(path.join(rootPath, 'product.json')) as IProductConfiguration);
- const pkg = require.__$__nodeRequire(path.join(rootPath, 'package.json')) as { version: string; };
+ const pkg = require.__$__nodeRequire(path.join(rootPath, 'package.json')) as { version: string; codeServerVersion: string; };
2019-07-17 03:57:02 +08:00
2019-10-19 07:20:02 +08:00
// Running out of sources
if (env['VSCODE_DEV']) {
2019-12-17 06:52:29 +08:00
@@ -48,7 +56,8 @@ else if (typeof require !== 'undefined' && typeof require.__$__nodeRequire === '
2019-07-17 03:57:02 +08:00
}
2019-08-10 07:50:05 +08:00
2019-10-19 07:20:02 +08:00
assign(product, {
- version: pkg.version
+ version: pkg.version,
+ codeServerVersion: pkg.codeServerVersion,
});
2019-08-08 05:18:17 +08:00
}
2019-10-19 07:20:02 +08:00
diff --git a/src/vs/platform/product/common/productService.ts b/src/vs/platform/product/common/productService.ts
2020-02-13 04:09:52 +08:00
index 120fd66644..52547bdb0e 100644
2019-10-19 07:20:02 +08:00
--- a/src/vs/platform/product/common/productService.ts
+++ b/src/vs/platform/product/common/productService.ts
2019-12-17 06:52:29 +08:00
@@ -16,6 +16,7 @@ export interface IProductService extends Readonly<IProductConfiguration> {
2019-10-19 07:20:02 +08:00
export interface IProductConfiguration {
readonly version: string;
+ readonly codeServerVersion: string;
readonly date?: string;
readonly quality?: string;
readonly commit?: string;
2019-08-10 07:50:05 +08:00
diff --git a/src/vs/platform/remote/browser/browserSocketFactory.ts b/src/vs/platform/remote/browser/browserSocketFactory.ts
2019-10-19 07:20:02 +08:00
index d0f6e6b18a..1966fd297d 100644
2019-08-10 07:50:05 +08:00
--- a/src/vs/platform/remote/browser/browserSocketFactory.ts
+++ b/src/vs/platform/remote/browser/browserSocketFactory.ts
2019-10-19 07:20:02 +08:00
@@ -205,7 +205,8 @@ export class BrowserSocketFactory implements ISocketFactory {
2019-07-17 03:57:02 +08:00
}
2019-08-10 07:50:05 +08:00
connect(host: string, port: number, query: string, callback: IConnectCallback): void {
- const socket = this._webSocketFactory.create(`ws://${host}:${port}/?${query}&skipWebSocketFrames=false`);
2019-10-19 07:20:02 +08:00
+ // NOTE@coder: Modified to work against the current path.
2019-08-10 07:50:05 +08:00
+ const socket = this._webSocketFactory.create(`${window.location.protocol === 'https:' ? 'wss' : 'ws'}://${window.location.host}${window.location.pathname}?${query}&skipWebSocketFrames=false`);
const errorListener = socket.onError((err) => callback(err, undefined));
socket.onOpen(() => {
errorListener.dispose();
2019-10-19 07:20:02 +08:00
@@ -213,6 +214,3 @@ export class BrowserSocketFactory implements ISocketFactory {
2019-08-30 08:05:48 +08:00
});
}
}
-
-
-
2019-12-17 06:52:29 +08:00
diff --git a/src/vs/platform/request/common/request.ts b/src/vs/platform/request/common/request.ts
index 81ec255e65..c94829fc6a 100644
--- a/src/vs/platform/request/common/request.ts
+++ b/src/vs/platform/request/common/request.ts
@@ -16,7 +16,7 @@ export const IRequestService = createDecorator<IRequestService>('requestService'
export interface IRequestService {
_serviceBrand: undefined;
- request(options: IRequestOptions, token: CancellationToken): Promise<IRequestContext>;
+ request(options: IRequestOptions, token: CancellationToken, gzip?: boolean): Promise<IRequestContext>;
resolveProxy(url: string): Promise<string | undefined>;
}
diff --git a/src/vs/platform/request/node/requestService.ts b/src/vs/platform/request/node/requestService.ts
index ad44dcbc33..7a7b5261ff 100644
--- a/src/vs/platform/request/node/requestService.ts
+++ b/src/vs/platform/request/node/requestService.ts
@@ -57,7 +57,7 @@ export class RequestService extends Disposable implements IRequestService {
this.authorization = config.http && config.http.proxyAuthorization;
}
- async request(options: NodeRequestOptions, token: CancellationToken): Promise<IRequestContext> {
+ async request(options: NodeRequestOptions, token: CancellationToken, gzip?: boolean): Promise<IRequestContext> {
this.logService.trace('RequestService#request', options.url);
const { proxyUrl, strictSSL } = this;
@@ -70,7 +70,7 @@ export class RequestService extends Disposable implements IRequestService {
options.headers = assign(options.headers || {}, { 'Proxy-Authorization': this.authorization });
}
- return this._request(options, token);
+ return this._request(options, token, gzip);
}
private async getNodeRequest(options: IRequestOptions): Promise<IRawRequestFunction> {
@@ -79,7 +79,7 @@ export class RequestService extends Disposable implements IRequestService {
return module.request;
}
- private _request(options: NodeRequestOptions, token: CancellationToken): Promise<IRequestContext> {
+ private _request(options: NodeRequestOptions, token: CancellationToken, gzip?: boolean): Promise<IRequestContext> {
return new Promise<IRequestContext>(async (c, e) => {
let req: http.ClientRequest;
@@ -114,7 +114,7 @@ export class RequestService extends Disposable implements IRequestService {
} else {
let stream: streams.ReadableStream<Uint8Array> = res;
- if (res.headers['content-encoding'] === 'gzip') {
+ if (gzip || res.headers['content-encoding'] === 'gzip') {
stream = res.pipe(createGunzip());
}
2019-08-08 05:18:17 +08:00
diff --git a/src/vs/platform/update/electron-main/abstractUpdateService.ts b/src/vs/platform/update/electron-main/abstractUpdateService.ts
2020-02-13 04:09:52 +08:00
index d8bf464fed..748715da3b 100644
2019-08-08 05:18:17 +08:00
--- a/src/vs/platform/update/electron-main/abstractUpdateService.ts
+++ b/src/vs/platform/update/electron-main/abstractUpdateService.ts
2019-08-10 07:50:05 +08:00
@@ -6,7 +6,6 @@
2019-08-08 05:18:17 +08:00
import { Event, Emitter } from 'vs/base/common/event';
import { timeout } from 'vs/base/common/async';
import { IConfigurationService, getMigratedSettingValue } from 'vs/platform/configuration/common/configuration';
2019-10-19 07:20:02 +08:00
-import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
import product from 'vs/platform/product/common/product';
2019-08-08 05:18:17 +08:00
import { IUpdateService, State, StateType, AvailableForDownload, UpdateType } from 'vs/platform/update/common/update';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
2019-08-10 07:50:05 +08:00
@@ -44,7 +43,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
2019-08-08 05:18:17 +08:00
}
constructor(
2019-10-19 07:20:02 +08:00
- @ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService,
+ _: any, // NOTE@coder: This depends on Electron so we skip it.
2019-08-08 05:18:17 +08:00
@IConfigurationService protected configurationService: IConfigurationService,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@IRequestService protected requestService: IRequestService,
2020-02-13 04:09:52 +08:00
@@ -156,15 +155,8 @@ export abstract class AbstractUpdateService implements IUpdateService {
2019-08-08 05:18:17 +08:00
this.logService.trace('update#quitAndInstall(): before lifecycle quit()');
2019-10-19 07:20:02 +08:00
- this.lifecycleMainService.quit(true /* from update */).then(vetod => {
2019-08-08 05:18:17 +08:00
- this.logService.trace(`update#quitAndInstall(): after lifecycle quit() with veto: ${vetod}`);
- if (vetod) {
- return;
- }
2019-10-19 07:20:02 +08:00
-
2019-08-08 05:18:17 +08:00
this.logService.trace('update#quitAndInstall(): running raw#quitAndInstall()');
this.doQuitAndInstall();
- });
return Promise.resolve(undefined);
}
2019-10-05 07:14:07 +08:00
diff --git a/src/vs/workbench/api/browser/extensionHost.contribution.ts b/src/vs/workbench/api/browser/extensionHost.contribution.ts
2020-02-13 04:09:52 +08:00
index e69aa80159..2960d00456 100644
2019-10-05 07:14:07 +08:00
--- a/src/vs/workbench/api/browser/extensionHost.contribution.ts
+++ b/src/vs/workbench/api/browser/extensionHost.contribution.ts
2020-02-13 04:09:52 +08:00
@@ -62,6 +62,7 @@ import './mainThreadTunnelService';
import './mainThreadAuthentication';
import './mainThreadTimeline';
2019-10-05 07:14:07 +08:00
import 'vs/workbench/api/common/apiCommands';
+import 'vs/server/src/browser/mainThreadNodeProxy';
export class ExtensionPoints implements IWorkbenchContribution {
diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts
2020-02-13 04:09:52 +08:00
index 91045fcda6..d93d3286d8 100644
2019-10-05 07:14:07 +08:00
--- a/src/vs/workbench/api/common/extHost.api.impl.ts
+++ b/src/vs/workbench/api/common/extHost.api.impl.ts
2020-02-13 04:09:52 +08:00
@@ -72,6 +72,7 @@ import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelServ
import { IExtHostApiDeprecationService } from 'vs/workbench/api/common/extHostApiDeprecationService';
import { ExtHostAuthentication } from 'vs/workbench/api/common/extHostAuthentication';
import { ExtHostTimeline } from 'vs/workbench/api/common/extHostTimeline';
2019-10-05 07:14:07 +08:00
+import { IExtHostNodeProxy } from 'vs/server/src/browser/extHostNodeProxy';
export interface IExtensionApiFactory {
(extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode;
2020-02-13 04:09:52 +08:00
@@ -93,6 +94,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
2019-10-05 07:14:07 +08:00
const extHostLogService = accessor.get(ILogService);
2020-02-13 04:09:52 +08:00
const extHostTunnelService = accessor.get(IExtHostTunnelService);
const extHostApiDeprecation = accessor.get(IExtHostApiDeprecationService);
2019-10-05 07:14:07 +08:00
+ const extHostNodeProxy = accessor.get(IExtHostNodeProxy);
// register addressable instances
rpcProtocol.set(ExtHostContext.ExtHostLogService, <ExtHostLogServiceShape><any>extHostLogService);
2020-02-13 04:09:52 +08:00
@@ -101,6 +103,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
2019-10-05 07:14:07 +08:00
rpcProtocol.set(ExtHostContext.ExtHostExtensionService, extensionService);
rpcProtocol.set(ExtHostContext.ExtHostStorage, extHostStorage);
2020-02-13 04:09:52 +08:00
rpcProtocol.set(ExtHostContext.ExtHostTunnelService, extHostTunnelService);
2019-10-05 07:14:07 +08:00
+ rpcProtocol.set(ExtHostContext.ExtHostNodeProxy, extHostNodeProxy);
// automatically create and register addressable instances
const extHostDecorations = rpcProtocol.set(ExtHostContext.ExtHostDecorations, accessor.get(IExtHostDecorations));
diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts
2020-02-13 04:09:52 +08:00
index 55130ff918..032534b23e 100644
2019-10-05 07:14:07 +08:00
--- a/src/vs/workbench/api/common/extHost.protocol.ts
+++ b/src/vs/workbench/api/common/extHost.protocol.ts
2020-02-13 04:09:52 +08:00
@@ -667,6 +667,16 @@ export interface MainThreadLabelServiceShape extends IDisposable {
2019-10-05 07:14:07 +08:00
$unregisterResourceLabelFormatter(handle: number): void;
}
+export interface MainThreadNodeProxyShape extends IDisposable {
+ $send(message: string): void;
+}
+export interface ExtHostNodeProxyShape {
+ $onMessage(message: string): void;
+ $onClose(): void;
+ $onDown(): void;
+ $onUp(): void;
+}
+
2020-02-13 04:09:52 +08:00
export interface MainThreadSearchShape extends IDisposable {
$registerFileSearchProvider(handle: number, scheme: string): void;
$registerTextSearchProvider(handle: number, scheme: string): void;
@@ -1498,7 +1508,8 @@ export const MainContext = {
MainThreadLabelService: createMainId<MainThreadLabelServiceShape>('MainThreadLabelService'),
MainThreadTheming: createMainId<MainThreadThemingShape>('MainThreadTheming'),
MainThreadTunnelService: createMainId<MainThreadTunnelServiceShape>('MainThreadTunnelService'),
- MainThreadTimeline: createMainId<MainThreadTimelineShape>('MainThreadTimeline')
+ MainThreadTimeline: createMainId<MainThreadTimelineShape>('MainThreadTimeline'),
+ MainThreadNodeProxy: createMainId<MainThreadNodeProxyShape>('MainThreadNodeProxy'),
2019-10-05 07:14:07 +08:00
};
export const ExtHostContext = {
2020-02-13 04:09:52 +08:00
@@ -1536,5 +1547,6 @@ export const ExtHostContext = {
ExtHostTheming: createMainId<ExtHostThemingShape>('ExtHostTheming'),
ExtHostTunnelService: createMainId<ExtHostTunnelServiceShape>('ExtHostTunnelService'),
ExtHostAuthentication: createMainId<ExtHostAuthenticationShape>('ExtHostAuthentication'),
- ExtHostTimeline: createMainId<ExtHostTimelineShape>('ExtHostTimeline')
+ ExtHostTimeline: createMainId<ExtHostTimelineShape>('ExtHostTimeline'),
2019-10-05 07:14:07 +08:00
+ ExtHostNodeProxy: createMainId<ExtHostNodeProxyShape>('ExtHostNodeProxy')
};
diff --git a/src/vs/workbench/api/common/extHostExtensionService.ts b/src/vs/workbench/api/common/extHostExtensionService.ts
2020-02-13 04:09:52 +08:00
index 978bf32fcd..a63954cce0 100644
2019-10-05 07:14:07 +08:00
--- a/src/vs/workbench/api/common/extHostExtensionService.ts
+++ b/src/vs/workbench/api/common/extHostExtensionService.ts
@@ -5,7 +5,7 @@
import * as nls from 'vs/nls';
import * as path from 'vs/base/common/path';
-import { originalFSPath, joinPath } from 'vs/base/common/resources';
+import { originalFSPath } from 'vs/base/common/resources';
import { Barrier } from 'vs/base/common/async';
import { dispose, toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { TernarySearchTree } from 'vs/base/common/map';
2020-02-13 04:09:52 +08:00
@@ -33,6 +33,7 @@ import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePa
2019-10-05 07:14:07 +08:00
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
2020-02-13 04:09:52 +08:00
import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService';
2019-10-05 07:14:07 +08:00
+import { IExtHostNodeProxy } from 'vs/server/src/browser/extHostNodeProxy';
interface ITestRunner {
/** Old test runner API, as exported from `vscode/lib/testrunner` */
2020-02-13 04:09:52 +08:00
@@ -78,6 +79,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
2019-10-05 07:14:07 +08:00
protected readonly _extHostConfiguration: ExtHostConfiguration;
protected readonly _logService: ILogService;
2020-02-13 04:09:52 +08:00
protected readonly _extHostTunnelService: IExtHostTunnelService;
2019-10-05 07:14:07 +08:00
+ protected readonly _nodeProxy: IExtHostNodeProxy;
protected readonly _mainThreadWorkspaceProxy: MainThreadWorkspaceShape;
protected readonly _mainThreadTelemetryProxy: MainThreadTelemetryShape;
2020-02-13 04:09:52 +08:00
@@ -107,7 +109,8 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
2019-10-05 07:14:07 +08:00
@ILogService logService: ILogService,
@IExtHostInitDataService initData: IExtHostInitDataService,
2020-02-13 04:09:52 +08:00
@IExtensionStoragePaths storagePath: IExtensionStoragePaths,
- @IExtHostTunnelService extHostTunnelService: IExtHostTunnelService
+ @IExtHostTunnelService extHostTunnelService: IExtHostTunnelService,
2019-10-05 07:14:07 +08:00
+ @IExtHostNodeProxy nodeProxy: IExtHostNodeProxy,
) {
this._hostUtils = hostUtils;
this._extHostContext = extHostContext;
2020-02-13 04:09:52 +08:00
@@ -116,6 +119,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
2019-10-05 07:14:07 +08:00
this._extHostWorkspace = extHostWorkspace;
this._extHostConfiguration = extHostConfiguration;
this._logService = logService;
+ this._nodeProxy = nodeProxy;
2020-02-13 04:09:52 +08:00
this._extHostTunnelService = extHostTunnelService;
2019-10-05 07:14:07 +08:00
this._disposables = new DisposableStore();
2020-02-13 04:09:52 +08:00
@@ -341,14 +345,14 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
2019-10-05 07:14:07 +08:00
const activationTimesBuilder = new ExtensionActivationTimesBuilder(reason.startup);
2019-10-19 07:20:02 +08:00
return Promise.all([
- this._loadCommonJSModule<IExtensionModule>(joinPath(extensionDescription.extensionLocation, extensionDescription.main), activationTimesBuilder),
2019-10-05 07:14:07 +08:00
+ this._loadCommonJSModule<IExtensionModule>(extensionDescription, activationTimesBuilder),
this._loadExtensionContext(extensionDescription)
]).then(values => {
2019-10-19 07:20:02 +08:00
return AbstractExtHostExtensionService._callActivate(this._logService, extensionDescription.identifier, values[0], values[1], activationTimesBuilder);
2019-10-05 07:14:07 +08:00
});
}
- protected abstract _loadCommonJSModule<T>(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise<T>;
+ protected abstract _loadCommonJSModule<T>(module: URI | IExtensionDescription, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise<T>;
private _loadExtensionContext(extensionDescription: IExtensionDescription): Promise<vscode.ExtensionContext> {
diff --git a/src/vs/workbench/api/node/extHost.services.ts b/src/vs/workbench/api/node/extHost.services.ts
2020-02-13 04:09:52 +08:00
index 72ad75d63e..8c4edee5e3 100644
2019-10-05 07:14:07 +08:00
--- a/src/vs/workbench/api/node/extHost.services.ts
+++ b/src/vs/workbench/api/node/extHost.services.ts
2020-02-13 04:09:52 +08:00
@@ -29,6 +29,8 @@ import { ExtHostLogService } from 'vs/workbench/api/node/extHostLogService';
import { IExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService';
import { ExtHostTunnelService } from 'vs/workbench/api/node/extHostTunnelService';
import { IExtHostApiDeprecationService, ExtHostApiDeprecationService } from 'vs/workbench/api/common/extHostApiDeprecationService';
2019-10-05 07:14:07 +08:00
+import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
+import { IExtHostNodeProxy } from 'vs/server/src/browser/extHostNodeProxy';
// register singleton services
registerSingleton(ILogService, ExtHostLogService);
2020-02-13 04:09:52 +08:00
@@ -47,3 +49,19 @@ registerSingleton(IExtensionStoragePaths, ExtensionStoragePaths);
2019-10-05 07:14:07 +08:00
registerSingleton(IExtHostExtensionService, ExtHostExtensionService);
registerSingleton(IExtHostStorage, ExtHostStorage);
2020-02-13 04:09:52 +08:00
registerSingleton(IExtHostTunnelService, ExtHostTunnelService);
2019-10-05 07:14:07 +08:00
+
+function NotImplementedProxy<T>(name: ServiceIdentifier<T>): { new(): T } {
+ return <any>class {
+ constructor() {
+ return new Proxy({}, {
+ get(target: any, prop: string | number) {
+ if (target[prop]) {
+ return target[prop];
+ }
+ throw new Error(`Not Implemented: ${name}->${String(prop)}`);
+ }
+ });
+ }
+ };
+}
+registerSingleton(IExtHostNodeProxy, class extends NotImplementedProxy(IExtHostNodeProxy) {});
diff --git a/src/vs/workbench/api/node/extHostExtensionService.ts b/src/vs/workbench/api/node/extHostExtensionService.ts
2019-12-17 06:52:29 +08:00
index a1c3e50ffd..910627aaf9 100644
2019-10-05 07:14:07 +08:00
--- a/src/vs/workbench/api/node/extHostExtensionService.ts
+++ b/src/vs/workbench/api/node/extHostExtensionService.ts
@@ -13,6 +13,8 @@ import { ExtHostDownloadService } from 'vs/workbench/api/node/extHostDownloadSer
import { CLIServer } from 'vs/workbench/api/node/extHostCLIServer';
import { URI } from 'vs/base/common/uri';
import { Schemas } from 'vs/base/common/network';
+import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
+import { joinPath } from 'vs/base/common/resources';
class NodeModuleRequireInterceptor extends RequireInterceptor {
2019-12-17 06:52:29 +08:00
@@ -76,7 +78,10 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService {
2019-10-05 07:14:07 +08:00
};
}
- protected _loadCommonJSModule<T>(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise<T> {
+ protected _loadCommonJSModule<T>(module: URI | IExtensionDescription, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise<T> {
+ if (!URI.isUri(module)) {
+ module = joinPath(module.extensionLocation, module.main!);
+ }
if (module.scheme !== Schemas.file) {
throw new Error(`Cannot load URI: '${module}', must be of file-scheme`);
}
2020-01-16 07:13:06 +08:00
diff --git a/src/vs/workbench/api/node/extHostStoragePaths.ts b/src/vs/workbench/api/node/extHostStoragePaths.ts
index afdd6bf398..ac91318ce3 100644
--- a/src/vs/workbench/api/node/extHostStoragePaths.ts
+++ b/src/vs/workbench/api/node/extHostStoragePaths.ts
@@ -5,13 +5,14 @@
import * as path from 'vs/base/common/path';
import { URI } from 'vs/base/common/uri';
-import * as pfs from 'vs/base/node/pfs';
-import { IEnvironment, IStaticWorkspaceData } from 'vs/workbench/api/common/extHost.protocol';
+import { IEnvironment, IStaticWorkspaceData, MainContext } from 'vs/workbench/api/common/extHost.protocol';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePaths';
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
import { withNullAsUndefined } from 'vs/base/common/types';
import { ILogService } from 'vs/platform/log/common/log';
+import { IExtHostRpcService } from '../common/extHostRpcService';
+import { VSBuffer } from 'vs/base/common/buffer';
export class ExtensionStoragePaths implements IExtensionStoragePaths {
@@ -26,6 +27,7 @@ export class ExtensionStoragePaths implements IExtensionStoragePaths {
constructor(
@IExtHostInitDataService initData: IExtHostInitDataService,
@ILogService private readonly _logService: ILogService,
+ @IExtHostRpcService private readonly _extHostRpc: IExtHostRpcService,
) {
this._workspace = withNullAsUndefined(initData.workspace);
this._environment = initData.environment;
@@ -54,21 +56,25 @@ export class ExtensionStoragePaths implements IExtensionStoragePaths {
const storageName = this._workspace.id;
const storagePath = path.join(this._environment.appSettingsHome.fsPath, 'workspaceStorage', storageName);
- const exists = await pfs.dirExists(storagePath);
+ // NOTE@coder: Use the file system proxy so this will work in the browser.
+ // writeFile performs a mkdirp so we don't need to bother ourselves.
+ const fileSystem = this._extHostRpc.getProxy(MainContext.MainThreadFileSystem);
+ const exists = fileSystem.$stat(URI.file(storagePath))
if (exists) {
return storagePath;
}
try {
- await pfs.mkdirp(storagePath);
- await pfs.writeFile(
- path.join(storagePath, 'meta.json'),
- JSON.stringify({
- id: this._workspace.id,
- configuration: this._workspace.configuration && URI.revive(this._workspace.configuration).toString(),
- name: this._workspace.name
- }, undefined, 2)
+ await fileSystem.$writeFile(
+ URI.file(path.join(storagePath, 'meta.json')),
+ VSBuffer.fromString(
+ JSON.stringify({
+ id: this._workspace.id,
+ configuration: this._workspace.configuration && URI.revive(this._workspace.configuration).toString(),
+ name: this._workspace.name
+ }, undefined, 2)
+ )
);
return storagePath;
2019-10-05 07:14:07 +08:00
diff --git a/src/vs/workbench/api/worker/extHostExtensionService.ts b/src/vs/workbench/api/worker/extHostExtensionService.ts
2019-12-17 06:52:29 +08:00
index 4781f22676..25143a97c0 100644
2019-10-05 07:14:07 +08:00
--- a/src/vs/workbench/api/worker/extHostExtensionService.ts
+++ b/src/vs/workbench/api/worker/extHostExtensionService.ts
2019-10-24 02:12:11 +08:00
@@ -9,6 +9,9 @@ import { AbstractExtHostExtensionService } from 'vs/workbench/api/common/extHost
2019-10-19 07:20:02 +08:00
import { endsWith } from 'vs/base/common/strings';
2019-10-05 07:14:07 +08:00
import { URI } from 'vs/base/common/uri';
import { RequireInterceptor } from 'vs/workbench/api/common/extHostRequireInterceptor';
2019-10-19 07:20:02 +08:00
+import { joinPath } from 'vs/base/common/resources';
2019-10-05 07:14:07 +08:00
+import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
2019-10-24 02:12:11 +08:00
+import { loadCommonJSModule } from 'vs/server/src/browser/worker';
2019-10-05 07:14:07 +08:00
2019-10-19 07:20:02 +08:00
class WorkerRequireInterceptor extends RequireInterceptor {
2019-10-05 07:14:07 +08:00
2019-10-24 02:12:11 +08:00
@@ -41,7 +44,14 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService {
2019-10-05 07:14:07 +08:00
await this._fakeModules.install();
}
2019-10-19 07:20:02 +08:00
- protected async _loadCommonJSModule<T>(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise<T> {
2019-10-05 07:14:07 +08:00
+ protected async _loadCommonJSModule<T>(module: URI | IExtensionDescription, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise<T> {
+ if (!URI.isUri(module) && module.extensionKind !== 'web') {
2019-12-17 06:52:29 +08:00
+ return loadCommonJSModule(module, activationTimesBuilder, this._nodeProxy, this._logService, this._fakeModules!.getModule('vscode', module.extensionLocation));
2019-10-05 07:14:07 +08:00
+ }
2019-10-19 07:20:02 +08:00
+
2019-10-05 07:14:07 +08:00
+ if (!URI.isUri(module)) {
+ module = joinPath(module.extensionLocation, module.main!);
+ }
2019-10-19 07:20:02 +08:00
module = module.with({ path: ensureSuffix(module.path, '.js') });
const response = await fetch(module.toString(true));
2019-10-24 02:12:11 +08:00
@@ -57,7 +67,7 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService {
2019-10-19 07:20:02 +08:00
const _exports = {};
const _module = { exports: _exports };
const _require = (request: string) => {
2019-12-17 06:52:29 +08:00
- const result = this._fakeModules!.getModule(request, module);
+ const result = this._fakeModules!.getModule(request, <URI>module);
2019-10-19 07:20:02 +08:00
if (result === undefined) {
throw new Error(`Cannot load module '${request}'`);
}
2019-07-11 05:29:15 +08:00
diff --git a/src/vs/workbench/browser/web.main.ts b/src/vs/workbench/browser/web.main.ts
2020-02-13 06:49:34 +08:00
index 94e7052574..7e5563b417 100644
2019-07-11 05:29:15 +08:00
--- a/src/vs/workbench/browser/web.main.ts
+++ b/src/vs/workbench/browser/web.main.ts
2020-02-13 04:09:52 +08:00
@@ -49,6 +49,7 @@ import { IndexedDBLogProvider } from 'vs/workbench/services/log/browser/indexedD
2019-08-30 08:05:48 +08:00
import { InMemoryLogProvider } from 'vs/workbench/services/log/common/inMemoryLogProvider';
2019-10-19 07:20:02 +08:00
import { isWorkspaceToOpen, isFolderToOpen } from 'vs/platform/windows/common/windows';
2019-12-17 06:52:29 +08:00
import { getWorkspaceIdentifier } from 'vs/workbench/services/workspaces/browser/workspaces';
2019-10-05 07:14:07 +08:00
+import { initialize } from 'vs/server/src/browser/client';
2019-07-18 00:57:26 +08:00
2019-10-19 07:20:02 +08:00
class BrowserMain extends Disposable {
2019-07-18 00:57:26 +08:00
2020-02-13 04:09:52 +08:00
@@ -85,6 +86,7 @@ class BrowserMain extends Disposable {
2019-07-18 00:57:26 +08:00
2019-09-04 05:38:53 +08:00
// Startup
workbench.startup();
2019-08-03 08:26:41 +08:00
+ await initialize(services.serviceCollection);
2019-09-04 05:38:53 +08:00
}
2019-07-18 00:57:26 +08:00
2019-10-19 07:20:02 +08:00
private registerListeners(workbench: Workbench, storageService: BrowserStorageService): void {
2019-10-30 00:31:00 +08:00
diff --git a/src/vs/workbench/common/resources.ts b/src/vs/workbench/common/resources.ts
2019-12-17 06:52:29 +08:00
index c509716fc4..e416413084 100644
2019-10-30 00:31:00 +08:00
--- a/src/vs/workbench/common/resources.ts
+++ b/src/vs/workbench/common/resources.ts
@@ -15,6 +15,7 @@ import { ParsedExpression, IExpression, parse } from 'vs/base/common/glob';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
import { withNullAsUndefined } from 'vs/base/common/types';
+import { Schemas } from 'vs/base/common/network';
export class ResourceContextKey extends Disposable implements IContextKey<URI> {
2019-12-17 06:52:29 +08:00
@@ -63,7 +64,8 @@ export class ResourceContextKey extends Disposable implements IContextKey<URI> {
2019-10-30 00:31:00 +08:00
set(value: URI | null) {
if (!ResourceContextKey._uriEquals(this._resourceKey.get(), value)) {
this._resourceKey.set(value);
- this._schemeKey.set(value ? value.scheme : null);
2019-12-17 06:52:29 +08:00
+ // NOTE@coder: fixes extensions matching against file schemas.
2019-10-30 00:31:00 +08:00
+ this._schemeKey.set(value ? (value.scheme === Schemas.vscodeRemote ? Schemas.file : value.scheme) : null);
this._filenameKey.set(value ? basename(value) : null);
this._langIdKey.set(value ? this._modeService.getModeIdByFilepathOrFirstLine(value) : null);
this._extensionKey.set(value ? extname(value) : null);
2019-08-16 04:08:17 +08:00
diff --git a/src/vs/workbench/contrib/webview/browser/pre/main.js b/src/vs/workbench/contrib/webview/browser/pre/main.js
2020-02-13 04:09:52 +08:00
index 63c9af47e2..021358fef9 100644
2019-08-16 04:08:17 +08:00
--- a/src/vs/workbench/contrib/webview/browser/pre/main.js
+++ b/src/vs/workbench/contrib/webview/browser/pre/main.js
2019-12-17 06:52:29 +08:00
@@ -329,7 +329,8 @@
2019-10-19 07:20:02 +08:00
if (data.endpoint) {
2019-12-17 06:52:29 +08:00
try {
const endpointUrl = new URL(data.endpoint);
- csp.setAttribute('content', csp.getAttribute('content').replace(/vscode-resource:(?=(\s|;|$))/g, endpointUrl.origin));
+ // NOTE@coder: Add back the trailing slash so it'll work for sub-paths.
+ csp.setAttribute('content', csp.getAttribute('content').replace(/vscode-resource:(?=(\s|;|$))/g, endpointUrl.origin + "/"));
} catch (e) {
console.error('Could not rewrite csp');
}
2020-01-16 08:02:19 +08:00
diff --git a/src/vs/workbench/services/dialogs/browser/dialogService.ts b/src/vs/workbench/services/dialogs/browser/dialogService.ts
index f67f9aa064..add754cd5a 100644
--- a/src/vs/workbench/services/dialogs/browser/dialogService.ts
+++ b/src/vs/workbench/services/dialogs/browser/dialogService.ts
@@ -122,11 +122,12 @@ export class DialogService implements IDialogService {
async about(): Promise<void> {
const detail = nls.localize('aboutDetail',
- "Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
+ "Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}\nCode Server Version: {4}",
this.productService.version || 'Unknown',
this.productService.commit || 'Unknown',
this.productService.date || 'Unknown',
- navigator.userAgent
+ navigator.userAgent,
+ this.productService.codeServerVersion || 'Unknown',
);
const { choice } = await this.show(Severity.Info, this.productService.nameLong, [nls.localize('copy', "Copy"), nls.localize('ok', "OK")], { detail, cancelId: 1 });
2019-07-13 05:39:38 +08:00
diff --git a/src/vs/workbench/services/environment/browser/environmentService.ts b/src/vs/workbench/services/environment/browser/environmentService.ts
2020-02-13 04:09:52 +08:00
index 1bf4cfad2a..924a2fcd87 100644
2019-07-13 05:39:38 +08:00
--- a/src/vs/workbench/services/environment/browser/environmentService.ts
+++ b/src/vs/workbench/services/environment/browser/environmentService.ts
2020-02-13 04:09:52 +08:00
@@ -195,8 +195,8 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
2019-07-13 05:39:38 +08:00
2019-12-17 06:52:29 +08:00
@memoize
2019-10-19 07:20:02 +08:00
get webviewExternalEndpoint(): string {
- // TODO: get fallback from product.json
2019-12-17 06:52:29 +08:00
- return (this.options.webviewEndpoint || 'https://{{uuid}}.vscode-webview-test.com/{{commit}}').replace('{{commit}}', product.commit || '0d728c31ebdf03869d2687d9be0b017667c9ff37');
2019-10-19 07:20:02 +08:00
+ // NOTE@coder: Modified to work against the current URL.
+ return `${window.location.origin}${window.location.pathname.replace(/\/+$/, '')}/webview/`;
}
2019-12-17 06:52:29 +08:00
@memoize
2020-02-13 04:09:52 +08:00
@@ -249,6 +249,8 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
installSourcePath!: string;
2019-12-17 06:52:29 +08:00
2020-02-13 04:09:52 +08:00
builtinExtensionsPath!: string;
2019-12-17 06:52:29 +08:00
+ extraExtensionPaths!: string[];
+ extraBuiltinExtensionPaths!: string[];
2020-02-13 04:09:52 +08:00
globalStorageHome!: string;
workspaceStorageHome!: string;
2019-10-05 07:14:07 +08:00
diff --git a/src/vs/workbench/services/extensions/browser/extensionService.ts b/src/vs/workbench/services/extensions/browser/extensionService.ts
2020-02-13 04:09:52 +08:00
index fe891a042e..21d0d4bf61 100644
2019-10-05 07:14:07 +08:00
--- a/src/vs/workbench/services/extensions/browser/extensionService.ts
+++ b/src/vs/workbench/services/extensions/browser/extensionService.ts
@@ -119,6 +119,7 @@ export class ExtensionService extends AbstractExtensionService implements IExten
} else {
// remote: only enabled and none-web'ish extension
2019-12-17 06:52:29 +08:00
+ localExtensions.push(...remoteEnv.extensions.filter(extension => this._isEnabled(extension) && canExecuteOnWeb(extension, this._productService, this._configService)));
remoteEnv.extensions = remoteEnv.extensions.filter(extension => this._isEnabled(extension) && !canExecuteOnWeb(extension, this._productService, this._configService));
2019-10-05 07:14:07 +08:00
this._checkEnableProposedApi(remoteEnv.extensions);
diff --git a/src/vs/workbench/services/extensions/common/extensionsUtil.ts b/src/vs/workbench/services/extensions/common/extensionsUtil.ts
2020-02-13 04:09:52 +08:00
index 9e8352ac88..2d1cb0a107 100644
2019-10-05 07:14:07 +08:00
--- a/src/vs/workbench/services/extensions/common/extensionsUtil.ts
+++ b/src/vs/workbench/services/extensions/common/extensionsUtil.ts
2019-12-17 06:52:29 +08:00
@@ -32,7 +32,8 @@ export function canExecuteOnWorkspace(manifest: IExtensionManifest, productServi
2019-10-05 07:14:07 +08:00
2019-12-17 06:52:29 +08:00
export function canExecuteOnWeb(manifest: IExtensionManifest, productService: IProductService, configurationService: IConfigurationService): boolean {
const extensionKind = getExtensionKind(manifest, productService, configurationService);
- return extensionKind.some(kind => kind === 'web');
+ // NOTE@coder: hardcode vim for now.
+ return extensionKind.some(kind => kind === 'web') || manifest.name === 'vim';
2019-10-05 07:14:07 +08:00
}
2019-12-17 06:52:29 +08:00
export function getExtensionKind(manifest: IExtensionManifest, productService: IProductService, configurationService: IConfigurationService): ExtensionKind[] {
2019-09-10 07:44:17 +08:00
diff --git a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
2019-12-17 06:52:29 +08:00
index 0f35c54431..32fff09b18 100644
2019-09-10 07:44:17 +08:00
--- a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
+++ b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
2019-12-17 06:52:29 +08:00
@@ -53,12 +53,13 @@ const args = minimist(process.argv.slice(2), {
2019-09-14 02:07:50 +08:00
const Module = require.__$__nodeRequire('module') as any;
const originalLoad = Module._load;
- Module._load = function (request: string) {
+ Module._load = function (request: string, parent: object, isMain: boolean) {
if (request === 'natives') {
throw new Error('Either the extension or a NPM dependency is using the "natives" node module which is unsupported as it can cause a crash of the extension host. Click [here](https://go.microsoft.com/fwlink/?linkid=871887) to find out more');
}
- return originalLoad.apply(this, arguments);
2019-10-19 07:20:02 +08:00
+ // NOTE@coder: Map node_module.asar requests to regular node_modules.
2019-09-14 02:07:50 +08:00
+ return originalLoad.apply(this, [request.replace(/node_modules\.asar(\.unpacked)?/, 'node_modules'), parent, isMain]);
};
})();
2019-12-17 06:52:29 +08:00
@@ -131,8 +132,11 @@ function _createExtHostProtocol(): Promise<IMessagePassingProtocol> {
2019-10-19 07:20:02 +08:00
// Wait for rich client to reconnect
protocol.onSocketClose(() => {
- // The socket has closed, let's give the renderer a certain amount of time to reconnect
- disconnectRunner1.schedule();
+ // NOTE@coder: Inform the server so we can manage offline
+ // connections there instead. Our goal is to persist connections
+ // forever (to a reasonable point) to account for things like
+ // hibernating overnight.
+ process.send!({ type: 'VSCODE_EXTHOST_DISCONNECTED' });
});
2019-09-10 07:44:17 +08:00
}
2019-10-19 07:20:02 +08:00
}
2019-10-05 07:14:07 +08:00
diff --git a/src/vs/workbench/services/extensions/worker/extHost.services.ts b/src/vs/workbench/services/extensions/worker/extHost.services.ts
2020-02-13 04:09:52 +08:00
index bbb72e9511..63f1f6ff46 100644
2019-10-05 07:14:07 +08:00
--- a/src/vs/workbench/services/extensions/worker/extHost.services.ts
+++ b/src/vs/workbench/services/extensions/worker/extHost.services.ts
2020-02-13 04:09:52 +08:00
@@ -18,11 +18,12 @@ import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePa
2020-01-16 07:13:06 +08:00
import { IExtHostExtensionService } from 'vs/workbench/api/common/extHostExtensionService';
import { IExtHostStorage, ExtHostStorage } from 'vs/workbench/api/common/extHostStorage';
import { ExtHostExtensionService } from 'vs/workbench/api/worker/extHostExtensionService';
-import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
2019-10-05 07:14:07 +08:00
import { ILogService } from 'vs/platform/log/common/log';
import { ExtHostLogService } from 'vs/workbench/api/worker/extHostLogService';
2020-02-13 04:09:52 +08:00
import { IExtHostTunnelService, ExtHostTunnelService } from 'vs/workbench/api/common/extHostTunnelService';
import { IExtHostApiDeprecationService, ExtHostApiDeprecationService, } from 'vs/workbench/api/common/extHostApiDeprecationService';
2019-10-05 07:14:07 +08:00
+import { ExtHostNodeProxy, IExtHostNodeProxy } from 'vs/server/src/browser/extHostNodeProxy';
2020-01-16 07:13:06 +08:00
+import { ExtensionStoragePaths } from 'vs/workbench/api/node/extHostStoragePaths';
2019-10-05 07:14:07 +08:00
// register singleton services
registerSingleton(ILogService, ExtHostLogService);
2020-02-13 04:09:52 +08:00
@@ -37,23 +38,9 @@ registerSingleton(IExtHostStorage, ExtHostStorage);
2019-10-05 07:14:07 +08:00
registerSingleton(IExtHostExtensionService, ExtHostExtensionService);
2019-12-17 06:52:29 +08:00
registerSingleton(IExtHostSearch, ExtHostSearch);
2020-02-13 04:09:52 +08:00
registerSingleton(IExtHostTunnelService, ExtHostTunnelService);
2019-10-05 07:14:07 +08:00
+registerSingleton(IExtHostNodeProxy, ExtHostNodeProxy);
2020-01-16 07:13:06 +08:00
-// register services that only throw errors
-function NotImplementedProxy<T>(name: ServiceIdentifier<T>): { new(): T } {
- return <any>class {
- constructor() {
- return new Proxy({}, {
- get(target: any, prop: string | number) {
- if (target[prop]) {
- return target[prop];
- }
- throw new Error(`Not Implemented: ${name}->${String(prop)}`);
- }
- });
- }
- };
-}
registerSingleton(IExtHostTerminalService, WorkerExtHostTerminalService);
registerSingleton(IExtHostTask, WorkerExtHostTask);
registerSingleton(IExtHostDebugService, WorkerExtHostDebugService);
2020-02-13 04:09:52 +08:00
-registerSingleton(IExtensionStoragePaths, class extends NotImplementedProxy(IExtensionStoragePaths) { whenReady = Promise.resolve(); });
2020-01-16 07:13:06 +08:00
+registerSingleton(IExtensionStoragePaths, ExtensionStoragePaths);
2019-10-19 07:20:02 +08:00
diff --git a/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts b/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts
index 99394090da..4891e0fece 100644
--- a/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts
+++ b/src/vs/workbench/services/localizations/electron-browser/localizationsService.ts
@@ -5,17 +5,17 @@
import { createChannelSender } from 'vs/base/parts/ipc/node/ipc';
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
-import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
+import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
export class LocalizationsService {
_serviceBrand: undefined;
constructor(
- @ISharedProcessService sharedProcessService: ISharedProcessService,
+ @IRemoteAgentService remoteAgentService: IRemoteAgentService,
) {
- return createChannelSender<ILocalizationsService>(sharedProcessService.getChannel('localizations'));
+ return createChannelSender<ILocalizationsService>(remoteAgentService.getConnection()!.getChannel('localizations'));
}
}
diff --git a/src/vs/workbench/services/update/electron-browser/updateService.ts b/src/vs/workbench/services/update/electron-browser/updateService.ts
2020-02-13 04:09:52 +08:00
index b8f6558b2c..7aeafe6e0e 100644
2019-10-19 07:20:02 +08:00
--- a/src/vs/workbench/services/update/electron-browser/updateService.ts
+++ b/src/vs/workbench/services/update/electron-browser/updateService.ts
2020-02-13 04:09:52 +08:00
@@ -6,8 +6,8 @@
2019-10-19 07:20:02 +08:00
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { Event, Emitter } from 'vs/base/common/event';
import { IUpdateService, State } from 'vs/platform/update/common/update';
-import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
2020-02-13 04:09:52 +08:00
+import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
2019-10-19 07:20:02 +08:00
export class NativeUpdateService implements IUpdateService {
2020-02-13 04:09:52 +08:00
2019-10-19 07:20:02 +08:00
@@ -21,8 +21,9 @@ export class NativeUpdateService implements IUpdateService {
private channel: IChannel;
- constructor(@IMainProcessService mainProcessService: IMainProcessService) {
- this.channel = mainProcessService.getChannel('update');
+ // NOTE@coder: patched to work in the browser.
+ constructor(@IRemoteAgentService remoteAgentService: IRemoteAgentService) {
+ this.channel = remoteAgentService.getConnection()!.getChannel('update');
// always set this._state as the state changes
this.onStateChange(state => this._state = state);
2019-07-11 05:29:15 +08:00
diff --git a/src/vs/workbench/workbench.web.main.ts b/src/vs/workbench/workbench.web.main.ts
2020-02-13 04:09:52 +08:00
index 0719b361e0..3a4c5cefe8 100644
2019-07-11 05:29:15 +08:00
--- a/src/vs/workbench/workbench.web.main.ts
+++ b/src/vs/workbench/workbench.web.main.ts
2019-10-19 07:20:02 +08:00
@@ -34,11 +34,14 @@ import 'vs/workbench/services/textfile/browser/browserTextFileService';
2019-08-30 08:05:48 +08:00
import 'vs/workbench/services/keybinding/browser/keymapService';
import 'vs/workbench/services/extensions/browser/extensionService';
import 'vs/workbench/services/extensionManagement/common/extensionManagementServerService';
2019-08-10 07:50:05 +08:00
-import 'vs/workbench/services/telemetry/browser/telemetryService';
2019-10-19 07:20:02 +08:00
+// NOTE@coder: We send it all to the server side to be processed there instead.
2019-08-30 08:05:48 +08:00
+// import 'vs/workbench/services/telemetry/browser/telemetryService';
2019-08-10 07:50:05 +08:00
import 'vs/workbench/services/configurationResolver/browser/configurationResolverService';
2019-08-30 08:05:48 +08:00
import 'vs/workbench/services/credentials/browser/credentialsService';
import 'vs/workbench/services/url/browser/urlService';
2019-10-19 07:20:02 +08:00
-import 'vs/workbench/services/update/browser/updateService';
+// NOTE@coder: Use the electron-browser version since it already comes with a
+// channel which lets us actually perform updates.
+import 'vs/workbench/services/update/electron-browser/updateService';
2019-12-17 06:52:29 +08:00
import 'vs/workbench/contrib/tags/browser/workspaceTagsService';
2019-10-19 07:20:02 +08:00
import 'vs/workbench/services/workspaces/browser/workspacesService';
import 'vs/workbench/services/workspaces/browser/workspaceEditingService';