2019-07-22 23:00:59 +02:00
diff --git a/src/vs/base/common/network.ts b/src/vs/base/common/network.ts
2019-10-29 17:23:34 +01:00
index 6d41e85e42..64f39687a4 100644
2019-07-22 23:00:59 +02:00
--- a/src/vs/base/common/network.ts
+++ b/src/vs/base/common/network.ts
2019-10-29 17:23:34 +01:00
@@ -96,12 +96,12 @@ class RemoteAuthoritiesImpl {
2019-10-19 01:20:02 +02:00
if (host && host.indexOf(':') !== -1) {
host = `[${host}]`;
}
2019-08-30 02:05:48 +02:00
- const port = this._ports[authority];
2019-10-19 01:20:02 +02:00
+ // NOTE@coder: Changed this to work against the current path.
2019-08-30 02:05:48 +02:00
const connectionToken = this._connectionTokens[authority];
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-10-19 01:20:02 +02:00
query: `path=${encodeURIComponent(uri.path)}&tkn=${encodeURIComponent(connectionToken)}`
2019-08-30 02:05:48 +02:00
});
}
2019-08-03 02:26:41 +02:00
diff --git a/src/vs/base/common/platform.ts b/src/vs/base/common/platform.ts
2019-10-19 01:20:02 +02:00
index a657f4a4d9..66bd13dffa 100644
2019-08-03 02:26:41 +02:00
--- a/src/vs/base/common/platform.ts
+++ b/src/vs/base/common/platform.ts
2019-10-19 01:20:02 +02:00
@@ -56,6 +56,16 @@ if (typeof navigator === 'object' && !isElectronRenderer) {
2019-08-03 02:26:41 +02:00
_isWeb = true;
2019-10-19 01:20:02 +02:00
_locale = navigator.language;
_language = _locale;
+ const el = typeof document !== 'undefined' && document.getElementById('vscode-remote-nls-configuration');
+ const rawNlsConfig = el && el.getAttribute('data-settings');
2019-08-03 02:26:41 +02: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-28 22:08:32 +01:00
diff --git a/src/vs/base/common/processes.ts b/src/vs/base/common/processes.ts
index c52f7b3774..5635cfac8a 100644
--- a/src/vs/base/common/processes.ts
+++ b/src/vs/base/common/processes.ts
@@ -110,7 +110,9 @@ export function sanitizeProcessEnvironment(env: IProcessEnvironment, ...preserve
/^ELECTRON_.+$/,
/^GOOGLE_API_KEY$/,
/^VSCODE_.+$/,
- /^SNAP(|_.*)$/
+ /^SNAP(|_.*)$/,
+ /^NBIN_BYPASS$/,
+ /^LAUNCH_VSCODE$/
];
const envKeys = Object.keys(env);
envKeys
2019-09-19 21:41:17 +02:00
diff --git a/src/vs/base/node/languagePacks.js b/src/vs/base/node/languagePacks.js
2019-10-19 01:20:02 +02:00
index 3ae24454cb..fac8679290 100644
2019-09-19 21:41:17 +02:00
--- a/src/vs/base/node/languagePacks.js
+++ b/src/vs/base/node/languagePacks.js
2019-10-19 01:20:02 +02:00
@@ -146,7 +146,10 @@ function factory(nodeRequire, path, fs, perf) {
2019-09-19 21:41:17 +02:00
function getLanguagePackConfigurations(userDataPath) {
const configFile = path.join(userDataPath, 'languagepacks.json');
try {
- return nodeRequire(configFile);
2019-10-19 01:20:02 +02: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-19 21:41:17 +02: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.
2019-07-12 23:39:38 +02:00
diff --git a/src/vs/platform/environment/common/environment.ts b/src/vs/platform/environment/common/environment.ts
2019-10-19 01:20:02 +02:00
index 990755c4f3..06449bb9cb 100644
2019-07-12 23:39:38 +02:00
--- a/src/vs/platform/environment/common/environment.ts
+++ b/src/vs/platform/environment/common/environment.ts
2019-10-19 01:20:02 +02:00
@@ -36,6 +36,8 @@ export interface ParsedArgs {
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;
@@ -169,4 +171,6 @@ export interface IEnvironmentService {
2019-08-30 02:05:48 +02:00
driverVerbose: boolean;
2019-08-10 01:50:05 +02:00
2019-08-30 02:05:48 +02:00
galleryMachineIdResource?: URI;
2019-07-12 23:39:38 +02:00
+ extraExtensionPaths: string[];
+ extraBuiltinExtensionPaths: string[];
}
2019-10-19 01:20:02 +02:00
diff --git a/src/vs/platform/environment/node/argv.ts b/src/vs/platform/environment/node/argv.ts
2019-10-25 18:53:20 +02:00
index 3e48fe4ddd..2212ff5471 100644
2019-10-19 01:20:02 +02:00
--- a/src/vs/platform/environment/node/argv.ts
+++ b/src/vs/platform/environment/node/argv.ts
@@ -58,6 +58,8 @@ export const OPTIONS: OptionDescriptions<Required<ParsedArgs>> = {
'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.") },
2019-10-25 18:53:20 +02:00
@@ -185,7 +187,7 @@ export function parseArgs<T>(args: string[], options: OptionDescriptions<T>, err
delete parsedArgs[o.deprecates];
}
- if (val) {
+ if (typeof val !== 'undefined') {
if (o.type === 'string[]') {
if (val && !Array.isArray(val)) {
val = [val];
2019-07-12 23:39:38 +02:00
diff --git a/src/vs/platform/environment/node/environmentService.ts b/src/vs/platform/environment/node/environmentService.ts
2019-10-19 01:20:02 +02:00
index f7d207009d..5c37b52dab 100644
2019-07-12 23:39:38 +02:00
--- a/src/vs/platform/environment/node/environmentService.ts
+++ b/src/vs/platform/environment/node/environmentService.ts
2019-10-19 01:20:02 +02:00
@@ -260,6 +260,12 @@ export class EnvironmentService implements IEnvironmentService {
2019-07-12 23:39:38 +02:00
2019-08-30 02:05:48 +02:00
get driverHandle(): string | undefined { return this._args['driver']; }
get driverVerbose(): boolean { return !!this._args['driver-verbose']; }
2019-08-10 01:50:05 +02:00
+ @memoize get extraExtensionPaths(): string[] {
2019-10-19 01:20:02 +02:00
+ return (this._args['extra-extensions-dir'] || []).map((p) => <string>parsePathArg(p, process));
2019-07-12 23:39:38 +02:00
+ }
2019-08-10 01:50:05 +02:00
+ @memoize get extraBuiltinExtensionPaths(): string[] {
2019-10-19 01:20:02 +02:00
+ return (this._args['extra-builtin-extensions-dir'] || []).map((p) => <string>parsePathArg(p, process));
2019-08-10 01:50:05 +02:00
+ }
2019-07-12 23:39:38 +02:00
constructor(private _args: ParsedArgs, private _execPath: string) {
if (!process.env['VSCODE_LOGS']) {
diff --git a/src/vs/platform/extensionManagement/node/extensionManagementService.ts b/src/vs/platform/extensionManagement/node/extensionManagementService.ts
2019-10-19 01:20:02 +02:00
index f0eaa74a59..3abf9e1752 100644
2019-07-12 23:39:38 +02:00
--- a/src/vs/platform/extensionManagement/node/extensionManagementService.ts
+++ b/src/vs/platform/extensionManagement/node/extensionManagementService.ts
2019-08-30 02:05:48 +02:00
@@ -731,11 +731,15 @@ export class ExtensionManagementService extends Disposable implements IExtension
2019-07-12 23:39:38 +02: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 01:20:02 +02:00
+ this.logService.trace('Scanned system extensions:', result.length);
2019-07-12 23:39:38 +02:00
+ return result;
+ });
if (this.environmentService.isBuilt) {
return systemExtensionsPromise;
}
2019-08-30 02:05:48 +02:00
@@ -757,9 +761,16 @@ export class ExtensionManagementService extends Disposable implements IExtension
2019-07-12 23:39:38 +02: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), []));
+ }
+
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) {
2019-08-30 02:05:48 +02:00
@@ -774,6 +785,12 @@ export class ExtensionManagementService extends Disposable implements IExtension
2019-08-21 02:16:44 +02: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;
+ }
+ return [];
+ })
.then(extensionsFolders => Promise.all<ILocalExtension>(extensionsFolders.map(extensionFolder => limiter.queue(() => this.scanExtension(extensionFolder, root, type)))))
.then(extensions => extensions.filter(e => e && e.identifier));
}
2019-08-30 02:05:48 +02:00
@@ -812,7 +829,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
2019-07-12 23:39:38 +02: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()]) {
2019-08-30 02:05:48 +02:00
@@ -831,7 +848,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
2019-07-12 23:39:38 +02: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 01:20:02 +02:00
diff --git a/src/vs/platform/product/common/product.ts b/src/vs/platform/product/common/product.ts
index 2de51e8d32..837770990e 100644
--- a/src/vs/platform/product/common/product.ts
+++ b/src/vs/platform/product/common/product.ts
@@ -22,10 +22,16 @@ if (isWeb) {
if (Object.keys(product).length === 0) {
assign(product, {
version: '1.39.0-dev',
+ codeServerVersion: 'dev',
nameLong: 'Visual Studio Code Web Dev',
nameShort: 'VSCode Web Dev'
});
2019-08-03 02:26:41 +02:00
}
2019-10-19 01:20:02 +02: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 02:26:41 +02:00
2019-10-19 01:20:02 +02:00
// Node: AMD loader
@@ -35,7 +41,7 @@ else if (typeof require !== 'undefined' && typeof require.__$__nodeRequire === '
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-16 21:57:02 +02:00
2019-10-19 01:20:02 +02:00
// Running out of sources
if (env['VSCODE_DEV']) {
@@ -47,7 +53,8 @@ else if (typeof require !== 'undefined' && typeof require.__$__nodeRequire === '
2019-07-16 21:57:02 +02:00
}
2019-08-10 01:50:05 +02:00
2019-10-19 01:20:02 +02:00
assign(product, {
- version: pkg.version
+ version: pkg.version,
+ codeServerVersion: pkg.codeServerVersion,
});
2019-08-07 23:18:17 +02:00
}
2019-10-19 01:20:02 +02:00
diff --git a/src/vs/platform/product/common/productService.ts b/src/vs/platform/product/common/productService.ts
index 5aa5c32d7e..e4e7fd4174 100644
--- a/src/vs/platform/product/common/productService.ts
+++ b/src/vs/platform/product/common/productService.ts
@@ -15,6 +15,7 @@ export interface IProductService extends Readonly<IProductConfiguration> {
export interface IProductConfiguration {
readonly version: string;
+ readonly codeServerVersion: string;
readonly date?: string;
readonly quality?: string;
readonly commit?: string;
2019-08-10 01:50:05 +02:00
diff --git a/src/vs/platform/remote/browser/browserSocketFactory.ts b/src/vs/platform/remote/browser/browserSocketFactory.ts
2019-10-19 01:20:02 +02:00
index d0f6e6b18a..1966fd297d 100644
2019-08-10 01:50:05 +02:00
--- a/src/vs/platform/remote/browser/browserSocketFactory.ts
+++ b/src/vs/platform/remote/browser/browserSocketFactory.ts
2019-10-19 01:20:02 +02:00
@@ -205,7 +205,8 @@ export class BrowserSocketFactory implements ISocketFactory {
2019-07-16 21:57:02 +02:00
}
2019-08-10 01:50:05 +02: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 01:20:02 +02:00
+ // NOTE@coder: Modified to work against the current path.
2019-08-10 01:50:05 +02: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 01:20:02 +02:00
@@ -213,6 +214,3 @@ export class BrowserSocketFactory implements ISocketFactory {
2019-08-30 02:05:48 +02:00
});
}
}
-
-
-
2019-08-07 23:18:17 +02:00
diff --git a/src/vs/platform/update/electron-main/abstractUpdateService.ts b/src/vs/platform/update/electron-main/abstractUpdateService.ts
2019-10-19 01:20:02 +02:00
index 8a1c95d37b..8225a85d47 100644
2019-08-07 23:18:17 +02:00
--- a/src/vs/platform/update/electron-main/abstractUpdateService.ts
+++ b/src/vs/platform/update/electron-main/abstractUpdateService.ts
2019-08-10 01:50:05 +02:00
@@ -6,7 +6,6 @@
2019-08-07 23:18:17 +02: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 01:20:02 +02:00
-import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
import product from 'vs/platform/product/common/product';
2019-08-07 23:18:17 +02:00
import { IUpdateService, State, StateType, AvailableForDownload, UpdateType } from 'vs/platform/update/common/update';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
2019-08-10 01:50:05 +02:00
@@ -44,7 +43,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
2019-08-07 23:18:17 +02:00
}
constructor(
2019-10-19 01:20:02 +02:00
- @ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService,
+ _: any, // NOTE@coder: This depends on Electron so we skip it.
2019-08-07 23:18:17 +02:00
@IConfigurationService protected configurationService: IConfigurationService,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@IRequestService protected requestService: IRequestService,
2019-10-19 01:20:02 +02:00
@@ -152,15 +151,8 @@ export abstract class AbstractUpdateService implements IUpdateService {
2019-08-07 23:18:17 +02:00
this.logService.trace('update#quitAndInstall(): before lifecycle quit()');
2019-10-19 01:20:02 +02:00
- this.lifecycleMainService.quit(true /* from update */).then(vetod => {
2019-08-07 23:18:17 +02:00
- this.logService.trace(`update#quitAndInstall(): after lifecycle quit() with veto: ${vetod}`);
- if (vetod) {
- return;
- }
2019-10-19 01:20:02 +02:00
-
2019-08-07 23:18:17 +02:00
this.logService.trace('update#quitAndInstall(): running raw#quitAndInstall()');
this.doQuitAndInstall();
- });
return Promise.resolve(undefined);
}
2019-10-05 01:14:07 +02:00
diff --git a/src/vs/workbench/api/browser/extensionHost.contribution.ts b/src/vs/workbench/api/browser/extensionHost.contribution.ts
index 2905c52411..303ddf211f 100644
--- a/src/vs/workbench/api/browser/extensionHost.contribution.ts
+++ b/src/vs/workbench/api/browser/extensionHost.contribution.ts
@@ -57,6 +57,7 @@ import './mainThreadComments';
import './mainThreadTask';
import './mainThreadLabelService';
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
2019-10-19 01:20:02 +02:00
index 230d09a290..84753e6ac7 100644
2019-10-05 01:14:07 +02:00
--- a/src/vs/workbench/api/common/extHost.api.impl.ts
+++ b/src/vs/workbench/api/common/extHost.api.impl.ts
2019-10-19 01:20:02 +02:00
@@ -67,6 +67,7 @@ import { ILogService } from 'vs/platform/log/common/log';
2019-10-05 01:14:07 +02:00
import { IURITransformerService } from 'vs/workbench/api/common/extHostUriTransformerService';
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
+import { IExtHostNodeProxy } from 'vs/server/src/browser/extHostNodeProxy';
export interface IExtensionApiFactory {
(extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode;
2019-10-19 01:20:02 +02:00
@@ -86,6 +87,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
2019-10-05 01:14:07 +02:00
const rpcProtocol = accessor.get(IExtHostRpcService);
const extHostStorage = accessor.get(IExtHostStorage);
const extHostLogService = accessor.get(ILogService);
+ const extHostNodeProxy = accessor.get(IExtHostNodeProxy);
// register addressable instances
rpcProtocol.set(ExtHostContext.ExtHostLogService, <ExtHostLogServiceShape><any>extHostLogService);
2019-10-19 01:20:02 +02:00
@@ -93,6 +95,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
2019-10-05 01:14:07 +02:00
rpcProtocol.set(ExtHostContext.ExtHostConfiguration, extHostConfiguration);
rpcProtocol.set(ExtHostContext.ExtHostExtensionService, extensionService);
rpcProtocol.set(ExtHostContext.ExtHostStorage, extHostStorage);
+ 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
2019-10-19 01:20:02 +02:00
index 7bd6aa6cb7..7c28136366 100644
2019-10-05 01:14:07 +02:00
--- a/src/vs/workbench/api/common/extHost.protocol.ts
+++ b/src/vs/workbench/api/common/extHost.protocol.ts
2019-10-19 01:20:02 +02:00
@@ -627,6 +627,10 @@ export interface MainThreadLabelServiceShape extends IDisposable {
2019-10-05 01:14:07 +02:00
$unregisterResourceLabelFormatter(handle: number): void;
}
+export interface MainThreadNodeProxyShape extends IDisposable {
+ $send(message: string): void;
+}
+
export interface MainThreadSearchShape extends IDisposable {
$registerFileSearchProvider(handle: number, scheme: string): void;
$registerTextSearchProvider(handle: number, scheme: string): void;
2019-10-19 01:20:02 +02:00
@@ -860,6 +864,13 @@ export interface ExtHostLabelServiceShape {
2019-10-05 01:14:07 +02:00
$registerResourceLabelFormatter(formatter: ResourceLabelFormatter): IDisposable;
}
+export interface ExtHostNodeProxyShape {
+ $onMessage(message: string): void;
+ $onClose(): void;
+ $onDown(): void;
+ $onUp(): void;
+}
+
export interface ExtHostSearchShape {
$provideFileSearchResults(handle: number, session: number, query: search.IRawQuery, token: CancellationToken): Promise<search.ISearchCompleteStats>;
$provideTextSearchResults(handle: number, session: number, query: search.IRawTextQuery, token: CancellationToken): Promise<search.ISearchCompleteStats>;
2019-10-19 01:20:02 +02:00
@@ -1384,7 +1395,8 @@ export const MainContext = {
2019-10-05 01:14:07 +02:00
MainThreadSearch: createMainId<MainThreadSearchShape>('MainThreadSearch'),
MainThreadTask: createMainId<MainThreadTaskShape>('MainThreadTask'),
MainThreadWindow: createMainId<MainThreadWindowShape>('MainThreadWindow'),
- MainThreadLabelService: createMainId<MainThreadLabelServiceShape>('MainThreadLabelService')
+ MainThreadLabelService: createMainId<MainThreadLabelServiceShape>('MainThreadLabelService'),
+ MainThreadNodeProxy: createMainId<MainThreadNodeProxyShape>('MainThreadNodeProxy')
};
export const ExtHostContext = {
2019-10-19 01:20:02 +02:00
@@ -1418,5 +1430,6 @@ export const ExtHostContext = {
2019-10-05 01:14:07 +02:00
ExtHostStorage: createMainId<ExtHostStorageShape>('ExtHostStorage'),
ExtHostUrls: createExtId<ExtHostUrlsShape>('ExtHostUrls'),
ExtHostOutputService: createMainId<ExtHostOutputServiceShape>('ExtHostOutputService'),
- ExtHosLabelService: createMainId<ExtHostLabelServiceShape>('ExtHostLabelService')
+ ExtHosLabelService: createMainId<ExtHostLabelServiceShape>('ExtHostLabelService'),
+ ExtHostNodeProxy: createMainId<ExtHostNodeProxyShape>('ExtHostNodeProxy')
};
diff --git a/src/vs/workbench/api/common/extHostExtensionService.ts b/src/vs/workbench/api/common/extHostExtensionService.ts
2019-10-19 01:20:02 +02:00
index b5ce835e07..22be8516c1 100644
2019-10-05 01:14:07 +02: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';
@@ -32,6 +32,7 @@ import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitData
import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePaths';
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
+import { IExtHostNodeProxy } from 'vs/server/src/browser/extHostNodeProxy';
interface ITestRunner {
/** Old test runner API, as exported from `vscode/lib/testrunner` */
2019-10-19 01:20:02 +02:00
@@ -76,6 +77,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
2019-10-05 01:14:07 +02:00
protected readonly _extHostWorkspace: ExtHostWorkspace;
protected readonly _extHostConfiguration: ExtHostConfiguration;
protected readonly _logService: ILogService;
+ protected readonly _nodeProxy: IExtHostNodeProxy;
protected readonly _mainThreadWorkspaceProxy: MainThreadWorkspaceShape;
protected readonly _mainThreadTelemetryProxy: MainThreadTelemetryShape;
2019-10-19 01:20:02 +02:00
@@ -104,7 +106,8 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
2019-10-05 01:14:07 +02:00
@IExtHostConfiguration extHostConfiguration: IExtHostConfiguration,
@ILogService logService: ILogService,
@IExtHostInitDataService initData: IExtHostInitDataService,
- @IExtensionStoragePaths storagePath: IExtensionStoragePaths
+ @IExtensionStoragePaths storagePath: IExtensionStoragePaths,
+ @IExtHostNodeProxy nodeProxy: IExtHostNodeProxy,
) {
this._hostUtils = hostUtils;
this._extHostContext = extHostContext;
2019-10-19 01:20:02 +02:00
@@ -113,6 +116,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
2019-10-05 01:14:07 +02:00
this._extHostWorkspace = extHostWorkspace;
this._extHostConfiguration = extHostConfiguration;
this._logService = logService;
+ this._nodeProxy = nodeProxy;
this._disposables = new DisposableStore();
this._mainThreadWorkspaceProxy = this._extHostContext.getProxy(MainContext.MainThreadWorkspace);
2019-10-19 01:20:02 +02:00
@@ -331,14 +335,14 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
2019-10-05 01:14:07 +02:00
const activationTimesBuilder = new ExtensionActivationTimesBuilder(reason.startup);
2019-10-19 01:20:02 +02:00
return Promise.all([
- this._loadCommonJSModule<IExtensionModule>(joinPath(extensionDescription.extensionLocation, extensionDescription.main), activationTimesBuilder),
2019-10-05 01:14:07 +02:00
+ this._loadCommonJSModule<IExtensionModule>(extensionDescription, activationTimesBuilder),
this._loadExtensionContext(extensionDescription)
]).then(values => {
2019-10-19 01:20:02 +02:00
return AbstractExtHostExtensionService._callActivate(this._logService, extensionDescription.identifier, values[0], values[1], activationTimesBuilder);
2019-10-05 01:14:07 +02: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
index a227d8a67b..92553a976c 100644
--- a/src/vs/workbench/api/node/extHost.services.ts
+++ b/src/vs/workbench/api/node/extHost.services.ts
@@ -26,6 +26,8 @@ import { ExtHostExtensionService } from 'vs/workbench/api/node/extHostExtensionS
import { IExtHostStorage, ExtHostStorage } from 'vs/workbench/api/common/extHostStorage';
import { ILogService } from 'vs/platform/log/common/log';
import { ExtHostLogService } from 'vs/workbench/api/node/extHostLogService';
+import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
+import { IExtHostNodeProxy } from 'vs/server/src/browser/extHostNodeProxy';
// register singleton services
registerSingleton(ILogService, ExtHostLogService);
@@ -42,3 +44,19 @@ registerSingleton(IExtHostSearch, ExtHostSearch);
registerSingleton(IExtensionStoragePaths, ExtensionStoragePaths);
registerSingleton(IExtHostExtensionService, ExtHostExtensionService);
registerSingleton(IExtHostStorage, ExtHostStorage);
+
+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-10-19 01:20:02 +02:00
index 49a8e254fd..99d233aed5 100644
2019-10-05 01:14:07 +02: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 {
@@ -75,7 +77,10 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService {
};
}
- 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`);
}
diff --git a/src/vs/workbench/api/worker/extHostExtensionService.ts b/src/vs/workbench/api/worker/extHostExtensionService.ts
2019-10-23 20:12:11 +02:00
index afd82468c0..289145be54 100644
2019-10-05 01:14:07 +02:00
--- a/src/vs/workbench/api/worker/extHostExtensionService.ts
+++ b/src/vs/workbench/api/worker/extHostExtensionService.ts
2019-10-23 20:12:11 +02:00
@@ -9,6 +9,9 @@ import { AbstractExtHostExtensionService } from 'vs/workbench/api/common/extHost
2019-10-19 01:20:02 +02:00
import { endsWith } from 'vs/base/common/strings';
2019-10-05 01:14:07 +02:00
import { URI } from 'vs/base/common/uri';
import { RequireInterceptor } from 'vs/workbench/api/common/extHostRequireInterceptor';
2019-10-19 01:20:02 +02:00
+import { joinPath } from 'vs/base/common/resources';
2019-10-05 01:14:07 +02:00
+import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
2019-10-23 20:12:11 +02:00
+import { loadCommonJSModule } from 'vs/server/src/browser/worker';
2019-10-05 01:14:07 +02:00
2019-10-19 01:20:02 +02:00
class WorkerRequireInterceptor extends RequireInterceptor {
2019-10-05 01:14:07 +02:00
2019-10-23 20:12:11 +02:00
@@ -41,7 +44,14 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService {
2019-10-05 01:14:07 +02:00
await this._fakeModules.install();
}
2019-10-19 01:20:02 +02:00
- protected async _loadCommonJSModule<T>(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise<T> {
2019-10-05 01:14:07 +02:00
+ protected async _loadCommonJSModule<T>(module: URI | IExtensionDescription, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise<T> {
+ if (!URI.isUri(module) && module.extensionKind !== 'web') {
2019-10-23 20:12:11 +02:00
+ return loadCommonJSModule(module, activationTimesBuilder, this._nodeProxy, this._logService, this._fakeModules.getModule('vscode', module.extensionLocation));
2019-10-05 01:14:07 +02:00
+ }
2019-10-19 01:20:02 +02:00
+
2019-10-05 01:14:07 +02:00
+ if (!URI.isUri(module)) {
+ module = joinPath(module.extensionLocation, module.main!);
+ }
2019-10-19 01:20:02 +02:00
module = module.with({ path: ensureSuffix(module.path, '.js') });
const response = await fetch(module.toString(true));
2019-10-23 20:12:11 +02:00
@@ -57,7 +67,7 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService {
2019-10-19 01:20:02 +02:00
const _exports = {};
const _module = { exports: _exports };
const _require = (request: string) => {
- const result = this._fakeModules.getModule(request, module);
+ const result = this._fakeModules.getModule(request, <URI>module);
if (result === undefined) {
throw new Error(`Cannot load module '${request}'`);
}
2019-07-19 22:10:43 +02:00
diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts
2019-10-19 01:20:02 +02:00
index 005a025aa9..ab392630c0 100644
2019-07-19 22:10:43 +02:00
--- a/src/vs/workbench/browser/dnd.ts
+++ b/src/vs/workbench/browser/dnd.ts
2019-10-19 01:20:02 +02:00
@@ -32,6 +32,7 @@ import { IWorkspaceEditingService } from 'vs/workbench/services/workspaces/commo
2019-07-19 22:10:43 +02:00
import { withNullAsUndefined } from 'vs/base/common/types';
2019-08-10 01:50:05 +02:00
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
2019-10-19 01:20:02 +02:00
import { IHostService } from 'vs/workbench/services/host/browser/host';
2019-10-05 01:14:07 +02:00
+import { IUploadService } from 'vs/server/src/browser/upload';
2019-07-19 22:10:43 +02:00
export interface IDraggedResource {
resource: URI;
2019-10-19 01:20:02 +02:00
@@ -167,14 +168,15 @@ export class ResourcesDropHandler {
2019-07-19 22:10:43 +02:00
@IEditorService private readonly editorService: IEditorService,
@IConfigurationService private readonly configurationService: IConfigurationService,
2019-10-19 01:20:02 +02:00
@IWorkspaceEditingService private readonly workspaceEditingService: IWorkspaceEditingService,
- @IHostService private readonly hostService: IHostService
+ @IHostService private readonly hostService: IHostService,
2019-07-19 22:10:43 +02:00
+ @IUploadService private readonly uploadService: IUploadService,
) {
}
async handleDrop(event: DragEvent, resolveTargetGroup: () => IEditorGroup | undefined, afterDrop: (targetGroup: IEditorGroup | undefined) => void, targetIndex?: number): Promise<void> {
const untitledOrFileResources = extractResources(event).filter(r => this.fileService.canHandleResource(r.resource) || r.resource.scheme === Schemas.untitled);
if (!untitledOrFileResources.length) {
- return;
+ return this.uploadService.handleDrop(event, resolveTargetGroup, afterDrop, targetIndex);
}
// Make the window active to handle the drop properly within
2019-07-10 23:29:15 +02:00
diff --git a/src/vs/workbench/browser/web.main.ts b/src/vs/workbench/browser/web.main.ts
2019-10-19 01:20:02 +02:00
index 84c46faa36..957e8412e1 100644
2019-07-10 23:29:15 +02:00
--- a/src/vs/workbench/browser/web.main.ts
+++ b/src/vs/workbench/browser/web.main.ts
2019-10-19 01:20:02 +02:00
@@ -48,6 +48,7 @@ import { toLocalISOString } from 'vs/base/common/date';
2019-08-30 02:05:48 +02:00
import { IndexedDBLogProvider } from 'vs/workbench/services/log/browser/indexedDBLogProvider';
import { InMemoryLogProvider } from 'vs/workbench/services/log/common/inMemoryLogProvider';
2019-10-19 01:20:02 +02:00
import { isWorkspaceToOpen, isFolderToOpen } from 'vs/platform/windows/common/windows';
2019-10-05 01:14:07 +02:00
+import { initialize } from 'vs/server/src/browser/client';
2019-07-17 18:57:26 +02:00
2019-10-19 01:20:02 +02:00
class BrowserMain extends Disposable {
2019-07-17 18:57:26 +02:00
2019-10-19 01:20:02 +02:00
@@ -84,6 +85,7 @@ class BrowserMain extends Disposable {
2019-07-17 18:57:26 +02:00
2019-09-03 23:38:53 +02:00
// Startup
workbench.startup();
2019-08-03 02:26:41 +02:00
+ await initialize(services.serviceCollection);
2019-09-03 23:38:53 +02:00
}
2019-07-17 18:57:26 +02:00
2019-10-19 01:20:02 +02:00
private registerListeners(workbench: Workbench, storageService: BrowserStorageService): void {
@@ -238,6 +240,7 @@ class BrowserMain extends Disposable {
2019-08-30 02:05:48 +02:00
const channel = connection.getChannel<IChannel>(REMOTE_FILE_SYSTEM_CHANNEL_NAME);
2019-07-10 23:29:15 +02:00
const remoteFileSystemProvider = this._register(new RemoteExtensionsFileSystemProvider(channel, remoteAgentService.getEnvironment()));
2019-08-10 01:50:05 +02:00
fileService.registerProvider(Schemas.vscodeRemote, remoteFileSystemProvider);
2019-07-13 00:13:49 +02:00
+ fileService.registerProvider(Schemas.file, remoteFileSystemProvider);
2019-07-13 02:09:07 +02:00
2019-08-30 02:05:48 +02:00
if (!this.configuration.userDataProvider) {
2019-08-10 01:50:05 +02:00
const remoteUserDataUri = this.getRemoteUserDataUri();
2019-10-29 17:31:00 +01:00
diff --git a/src/vs/workbench/common/resources.ts b/src/vs/workbench/common/resources.ts
index 53de865d8f..df234821a9 100644
--- 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> {
@@ -63,7 +64,7 @@ export class ResourceContextKey extends Disposable implements IContextKey<URI> {
set(value: URI | null) {
if (!ResourceContextKey._uriEquals(this._resourceKey.get(), value)) {
this._resourceKey.set(value);
- this._schemeKey.set(value ? value.scheme : null);
+ 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);
@@ -200,4 +201,4 @@ export class ResourceGlobMatcher extends Disposable {
return !!expressionForRoot(resourcePathToMatch);
}
-}
\ No newline at end of file
+}
2019-07-19 22:10:43 +02:00
diff --git a/src/vs/workbench/contrib/files/browser/files.contribution.ts b/src/vs/workbench/contrib/files/browser/files.contribution.ts
2019-10-19 01:20:02 +02:00
index 1f4cd95f65..061931cbde 100644
2019-07-19 22:10:43 +02:00
--- a/src/vs/workbench/contrib/files/browser/files.contribution.ts
+++ b/src/vs/workbench/contrib/files/browser/files.contribution.ts
2019-10-19 01:20:02 +02:00
@@ -209,7 +209,7 @@ configurationRegistry.registerConfiguration({
2019-07-19 22:10:43 +02:00
'files.exclude': {
'type': 'object',
'markdownDescription': nls.localize('exclude', "Configure glob patterns for excluding files and folders. For example, the files explorer decides which files and folders to show or hide based on this setting. Read more about glob patterns [here](https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options)."),
- 'default': { '**/.git': true, '**/.svn': true, '**/.hg': true, '**/CVS': true, '**/.DS_Store': true },
+ 'default': { '**/.git': true, '**/.svn': true, '**/.hg': true, '**/CVS': true, '**/.DS_Store': true, '**/.code-server-partial-upload-*': true },
'scope': ConfigurationScope.RESOURCE,
'additionalProperties': {
'anyOf': [
diff --git a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts
2019-10-19 01:20:02 +02:00
index cc4bcb28c5..98679a8b32 100644
2019-07-19 22:10:43 +02:00
--- a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts
+++ b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts
2019-08-30 02:05:48 +02:00
@@ -47,6 +47,7 @@ import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/work
2019-07-19 22:10:43 +02:00
import { findValidPasteFileTarget } from 'vs/workbench/contrib/files/browser/fileActions';
import { FuzzyScore, createMatches } from 'vs/base/common/filters';
2019-08-30 02:05:48 +02:00
import { Emitter } from 'vs/base/common/event';
2019-10-05 01:14:07 +02:00
+import { IUploadService } from 'vs/server/src/browser/upload';
2019-07-19 22:10:43 +02:00
export class ExplorerDelegate implements IListVirtualDelegate<ExplorerItem> {
2019-10-19 01:20:02 +02:00
@@ -444,7 +445,8 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
2019-07-19 22:10:43 +02:00
@IInstantiationService private instantiationService: IInstantiationService,
@ITextFileService private textFileService: ITextFileService,
2019-10-19 01:20:02 +02:00
@IHostService private hostService: IHostService,
2019-07-19 22:10:43 +02:00
- @IWorkspaceEditingService private workspaceEditingService: IWorkspaceEditingService
+ @IWorkspaceEditingService private workspaceEditingService: IWorkspaceEditingService,
+ @IUploadService private readonly uploadService: IUploadService,
) {
this.toDispose = [];
2019-10-19 01:20:02 +02:00
@@ -605,6 +607,7 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
}
2019-07-19 22:10:43 +02:00
private async handleExternalDrop(data: DesktopDragAndDropData, target: ExplorerItem, originalEvent: DragEvent): Promise<void> {
+ return this.uploadService.handleExternalDrop(data, target, originalEvent);
const droppedResources = extractResources(originalEvent, true);
// Check for dropped external files to be folders
const result = await this.fileService.resolveAll(droppedResources);
2019-08-15 22:08:17 +02:00
diff --git a/src/vs/workbench/contrib/webview/browser/pre/main.js b/src/vs/workbench/contrib/webview/browser/pre/main.js
2019-10-19 01:20:02 +02:00
index e6b9fd854b..a3d0a46e3a 100644
2019-08-15 22:08:17 +02:00
--- a/src/vs/workbench/contrib/webview/browser/pre/main.js
+++ b/src/vs/workbench/contrib/webview/browser/pre/main.js
2019-10-19 01:20:02 +02:00
@@ -308,7 +308,8 @@
} else {
// Rewrite vscode-resource in csp
if (data.endpoint) {
- csp.setAttribute('content', csp.getAttribute('content').replace(/vscode-resource:/g, data.endpoint));
+ // NOTE@coder: Add back the trailing slash so it'll work for sub-paths.
+ csp.setAttribute('content', csp.getAttribute('content').replace(/vscode-resource:/g, data.endpoint + "/"));
}
}
2019-08-30 02:05:48 +02:00
2019-07-12 23:39:38 +02:00
diff --git a/src/vs/workbench/services/environment/browser/environmentService.ts b/src/vs/workbench/services/environment/browser/environmentService.ts
2019-10-19 01:20:02 +02:00
index 5f221e07ff..bfd592382c 100644
2019-07-12 23:39:38 +02:00
--- a/src/vs/workbench/services/environment/browser/environmentService.ts
+++ b/src/vs/workbench/services/environment/browser/environmentService.ts
2019-10-19 01:20:02 +02:00
@@ -15,7 +15,6 @@ import { IPath, IPathsToWaitFor, IWindowConfiguration } from 'vs/platform/window
import { ISingleFolderWorkspaceIdentifier, IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api';
-import product from 'vs/platform/product/common/product';
export class BrowserWindowConfiguration implements IWindowConfiguration {
@@ -180,12 +179,13 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
2019-08-30 02:05:48 +02:00
driverHandle?: string;
2019-07-12 23:39:38 +02:00
driverVerbose: boolean;
2019-08-10 01:50:05 +02:00
galleryMachineIdResource?: URI;
2019-07-12 23:39:38 +02:00
+ extraExtensionPaths: string[];
+ extraBuiltinExtensionPaths: string[];
2019-08-30 02:05:48 +02:00
readonly logFile: URI;
2019-07-12 23:39:38 +02:00
2019-10-19 01:20:02 +02:00
get webviewExternalEndpoint(): string {
- // TODO: get fallback from product.json
- return (this.options.webviewEndpoint || 'https://{{uuid}}.vscode-webview-test.com/{{commit}}')
- .replace('{{commit}}', product.commit || '211fa02efe8c041fd7baa8ec3dce199d5185aa44');
+ // NOTE@coder: Modified to work against the current URL.
+ return `${window.location.origin}${window.location.pathname.replace(/\/+$/, '')}/webview/`;
}
2019-07-12 23:39:38 +02:00
get webviewResourceRoot(): string {
2019-10-05 01:14:07 +02:00
diff --git a/src/vs/workbench/services/extensions/browser/extensionService.ts b/src/vs/workbench/services/extensions/browser/extensionService.ts
2019-10-19 01:20:02 +02:00
index 000e5f7b4a..39f46e68a1 100644
2019-10-05 01:14:07 +02: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
+ localExtensions.push(...remoteEnv.extensions.filter(extension => this._isEnabled(extension) && isWebExtension(extension, this._configService)));
remoteEnv.extensions = remoteEnv.extensions.filter(extension => this._isEnabled(extension) && !isWebExtension(extension, this._configService));
this._checkEnableProposedApi(remoteEnv.extensions);
diff --git a/src/vs/workbench/services/extensions/common/extensionsUtil.ts b/src/vs/workbench/services/extensions/common/extensionsUtil.ts
2019-10-19 01:20:02 +02:00
index 49b2d270c0..45200ccdbb 100644
2019-10-05 01:14:07 +02:00
--- a/src/vs/workbench/services/extensions/common/extensionsUtil.ts
+++ b/src/vs/workbench/services/extensions/common/extensionsUtil.ts
2019-10-19 01:20:02 +02:00
@@ -12,7 +12,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
2019-10-05 01:14:07 +02:00
export function isWebExtension(manifest: IExtensionManifest, configurationService: IConfigurationService): boolean {
const extensionKind = getExtensionKind(manifest, configurationService);
- return extensionKind === 'web';
+ return extensionKind === 'web' || manifest.name === 'vim';
}
export function isUIExtension(manifest: IExtensionManifest, productService: IProductService, configurationService: IConfigurationService): boolean {
2019-09-10 01:44:17 +02:00
diff --git a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
2019-10-19 01:20:02 +02:00
index 9f5a14f6cb..ca952f3d4d 100644
2019-09-10 01:44:17 +02:00
--- a/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
+++ b/src/vs/workbench/services/extensions/node/extensionHostProcessSetup.ts
2019-10-19 01:20:02 +02:00
@@ -42,12 +42,13 @@ const args = minimist(process.argv.slice(2), {
2019-09-13 20:07:50 +02: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 01:20:02 +02:00
+ // NOTE@coder: Map node_module.asar requests to regular node_modules.
2019-09-13 20:07:50 +02:00
+ return originalLoad.apply(this, [request.replace(/node_modules\.asar(\.unpacked)?/, 'node_modules'), parent, isMain]);
};
})();
2019-10-19 01:20:02 +02:00
@@ -120,8 +121,11 @@ function _createExtHostProtocol(): Promise<IMessagePassingProtocol> {
// 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 01:44:17 +02:00
}
2019-10-19 01:20:02 +02:00
}
2019-10-05 01:14:07 +02:00
diff --git a/src/vs/workbench/services/extensions/worker/extHost.services.ts b/src/vs/workbench/services/extensions/worker/extHost.services.ts
2019-10-19 01:20:02 +02:00
index 3bdfa1a79f..ded21cf9c6 100644
2019-10-05 01:14:07 +02:00
--- a/src/vs/workbench/services/extensions/worker/extHost.services.ts
+++ b/src/vs/workbench/services/extensions/worker/extHost.services.ts
@@ -21,6 +21,7 @@ import { ExtHostExtensionService } from 'vs/workbench/api/worker/extHostExtensio
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { ILogService } from 'vs/platform/log/common/log';
import { ExtHostLogService } from 'vs/workbench/api/worker/extHostLogService';
+import { ExtHostNodeProxy, IExtHostNodeProxy } from 'vs/server/src/browser/extHostNodeProxy';
// register singleton services
registerSingleton(ILogService, ExtHostLogService);
@@ -32,6 +33,7 @@ registerSingleton(IExtHostCommands, ExtHostCommands);
registerSingleton(IExtHostDocumentsAndEditors, ExtHostDocumentsAndEditors);
registerSingleton(IExtHostStorage, ExtHostStorage);
registerSingleton(IExtHostExtensionService, ExtHostExtensionService);
+registerSingleton(IExtHostNodeProxy, ExtHostNodeProxy);
// register services that only throw errors
function NotImplementedProxy<T>(name: ServiceIdentifier<T>): { new(): T } {
2019-10-19 01:20:02 +02: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
index b8f6558b2c..b1fe6b14fd 100644
--- a/src/vs/workbench/services/update/electron-browser/updateService.ts
+++ b/src/vs/workbench/services/update/electron-browser/updateService.ts
@@ -6,7 +6,7 @@
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 { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
export class NativeUpdateService implements IUpdateService {
@@ -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-10 23:29:15 +02:00
diff --git a/src/vs/workbench/workbench.web.main.ts b/src/vs/workbench/workbench.web.main.ts
2019-10-19 01:20:02 +02:00
index fa9c9dd7a9..688d6c1934 100644
2019-07-10 23:29:15 +02:00
--- a/src/vs/workbench/workbench.web.main.ts
+++ b/src/vs/workbench/workbench.web.main.ts
2019-10-19 01:20:02 +02:00
@@ -34,11 +34,14 @@ import 'vs/workbench/services/textfile/browser/browserTextFileService';
2019-08-30 02:05:48 +02: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 01:50:05 +02:00
-import 'vs/workbench/services/telemetry/browser/telemetryService';
2019-10-19 01:20:02 +02:00
+// NOTE@coder: We send it all to the server side to be processed there instead.
2019-08-30 02:05:48 +02:00
+// import 'vs/workbench/services/telemetry/browser/telemetryService';
2019-08-10 01:50:05 +02:00
import 'vs/workbench/services/configurationResolver/browser/configurationResolverService';
2019-08-30 02:05:48 +02:00
import 'vs/workbench/services/credentials/browser/credentialsService';
import 'vs/workbench/services/url/browser/urlService';
2019-10-19 01:20:02 +02: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';
import 'vs/workbench/contrib/stats/browser/workspaceStatsService';
import 'vs/workbench/services/workspaces/browser/workspacesService';
import 'vs/workbench/services/workspaces/browser/workspaceEditingService';