code-server/scripts/vscode.patch

1415 lines
70 KiB
Diff
Raw Normal View History

diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js
index 6bb695db68..7f6c5cd3cb 100644
--- a/build/gulpfile.vscode.js
+++ b/build/gulpfile.vscode.js
@@ -47,24 +47,28 @@ const nodeModules = ['electron', 'original-fs']
// Build
const vscodeEntryPoints = _.flatten([
- buildfile.entrypoint('vs/workbench/workbench.desktop.main'),
+ buildfile.entrypoint('vs/workbench/workbench.web.api'),
+ buildfile.entrypoint('vs/server/src/node/cli'),
buildfile.base,
2019-08-10 07:50:05 +08:00
buildfile.serviceWorker,
- buildfile.workbenchDesktop,
- buildfile.code
+ buildfile.workbenchWeb,
+ buildfile.workerExtensionHost,
+ buildfile.keyboardMaps,
]);
const vscodeResources = [
- 'out-build/main.js',
- 'out-build/cli.js',
- 'out-build/driver.js',
2019-08-10 07:50:05 +08:00
+ 'out-build/vs/server/main.js',
+ 'out-build/vs/server/src/node/uriTransformer.js',
+ 'out-build/vs/code/browser/workbench/**',
+ 'out-build/vs/server/src/media/*',
+ 'out-build/vs/workbench/services/extensions/worker/extensionHostWorkerMain.js',
+ '!out-build/vs/server/doc/**',
'out-build/bootstrap.js',
'out-build/bootstrap-fork.js',
'out-build/bootstrap-amd.js',
'out-build/bootstrap-window.js',
'out-build/paths.js',
'out-build/vs/**/*.{svg,png,html}',
- '!out-build/vs/code/browser/**/*.html',
'out-build/vs/base/common/performance.js',
'out-build/vs/base/node/languagePacks.js',
'out-build/vs/base/node/{stdForkStart.js,terminateProcess.sh,cpuUsage.sh,ps.sh}',
@@ -79,11 +83,7 @@ const vscodeResources = [
'out-build/vs/workbench/contrib/welcome/walkThrough/**/*.md',
2019-08-10 07:50:05 +08:00
'out-build/vs/platform/files/**/*.exe',
'out-build/vs/platform/files/**/*.md',
- 'out-build/vs/code/electron-browser/workbench/**',
- 'out-build/vs/code/electron-browser/sharedProcess/sharedProcess.js',
- 'out-build/vs/code/electron-browser/issue/issueReporter.js',
- 'out-build/vs/code/electron-browser/processExplorer/processExplorer.js',
- '!**/test/**'
+ '!**/test/**',
];
const optimizeVSCodeTask = task.define('optimize-vscode', task.series(
@@ -627,4 +627,3 @@ function getSettingsSearchBuildId(packageJson) {
throw new Error('Could not determine build number: ' + e.toString());
2019-08-10 07:50:05 +08:00
}
2019-07-23 05:00:59 +08:00
}
-
2019-08-23 00:33:58 +08:00
diff --git a/src/vs/base/browser/mouseEvent.ts b/src/vs/base/browser/mouseEvent.ts
2019-09-13 23:42:53 +08:00
index 4c7295e3b9..b0af2cdd62 100644
2019-08-23 00:33:58 +08:00
--- a/src/vs/base/browser/mouseEvent.ts
+++ b/src/vs/base/browser/mouseEvent.ts
2019-09-13 23:42:53 +08:00
@@ -160,6 +160,8 @@ export class StandardWheelEvent {
2019-08-23 00:33:58 +08:00
this.deltaY = e1.wheelDeltaY / 120;
2019-09-13 23:42:53 +08:00
} else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {
2019-08-23 00:33:58 +08:00
this.deltaY = -e2.detail / 3;
2019-09-13 23:42:53 +08:00
+ } else if (browser.isFirefox) {
+ this.deltaY = -e.deltaY / 3;
2019-08-23 00:33:58 +08:00
} else {
this.deltaY = -e.deltaY / 40;
2019-09-13 23:42:53 +08:00
}
@@ -173,6 +175,8 @@ export class StandardWheelEvent {
2019-08-23 00:33:58 +08:00
}
2019-09-13 23:42:53 +08:00
} else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {
2019-08-23 00:33:58 +08:00
this.deltaX = -e.detail / 3;
2019-09-13 23:42:53 +08:00
+ } else if (browser.isFirefox) {
+ this.deltaX = -e.deltaX / 3;
2019-08-23 00:33:58 +08:00
} else {
this.deltaX = -e.deltaX / 40;
2019-09-13 23:42:53 +08:00
}
2019-07-23 05:00:59 +08:00
diff --git a/src/vs/base/common/network.ts b/src/vs/base/common/network.ts
index 4f93e06df0..ae63e64a7f 100644
2019-07-23 05:00:59 +08:00
--- a/src/vs/base/common/network.ts
+++ b/src/vs/base/common/network.ts
@@ -48,7 +48,7 @@ export namespace Schemas {
2019-08-17 03:15:55 +08:00
2019-07-23 05:00:59 +08:00
export const command: string = 'command';
2019-08-17 03:15:55 +08:00
- export const vscodeRemote: string = 'vscode-remote';
+ export const vscodeRemote: string = 'code-server';
2019-08-10 07:50:05 +08:00
export const vscodeRemoteResource: string = 'vscode-remote-resource';
@@ -82,13 +82,11 @@ class RemoteAuthoritiesImpl {
}
public rewrite(authority: string, path: string): URI {
- const host = this._hosts[authority];
- const port = this._ports[authority];
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`,
query: `path=${encodeURIComponent(path)}&tkn=${encodeURIComponent(connectionToken)}`
});
}
diff --git a/src/vs/base/common/platform.ts b/src/vs/base/common/platform.ts
2019-09-13 01:49:28 +08:00
index 07759dffe5..9148d7c1f0 100644
--- a/src/vs/base/common/platform.ts
+++ b/src/vs/base/common/platform.ts
2019-08-10 07:50:05 +08:00
@@ -54,8 +54,18 @@ if (typeof navigator === 'object' && !isElectronRenderer) {
_isMacintosh = _userAgent.indexOf('Macintosh') >= 0;
_isLinux = _userAgent.indexOf('Linux') >= 0;
_isWeb = true;
- _locale = navigator.language;
- _language = _locale;
+ _locale = LANGUAGE_DEFAULT;
+ _language = LANGUAGE_DEFAULT;
+ const rawNlsConfig = typeof document !== 'undefined'
+ && document.getElementById('vscode-remote-nls-configuration')!.getAttribute('data-settings')!;
+ 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');
diff --git a/src/vs/base/node/languagePacks.js b/src/vs/base/node/languagePacks.js
index 3ae24454cb..d637d02855 100644
--- a/src/vs/base/node/languagePacks.js
+++ b/src/vs/base/node/languagePacks.js
@@ -146,7 +146,7 @@ function factory(nodeRequire, path, fs, perf) {
function getLanguagePackConfigurations(userDataPath) {
const configFile = path.join(userDataPath, 'languagepacks.json');
try {
- return nodeRequire(configFile);
+ 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-23 05:00:59 +08:00
diff --git a/src/vs/code/browser/workbench/workbench.html b/src/vs/code/browser/workbench/workbench.html
index 44f67f0a0b..50d29b1e87 100644
2019-07-23 05:00:59 +08:00
--- a/src/vs/code/browser/workbench/workbench.html
+++ b/src/vs/code/browser/workbench/workbench.html
@@ -18,10 +18,12 @@
2019-07-23 05:00:59 +08:00
<!-- Workarounds/Hacks (remote user data uri) -->
<meta id="vscode-remote-user-data-uri" data-settings="{{REMOTE_USER_DATA_URI}}">
+ <meta id="vscode-remote-nls-configuration" data-settings="{{NLS_CONFIGURATION}}">
<!-- Workbench Icon/Manifest/CSS -->
2019-08-10 07:50:05 +08:00
- <link rel="icon" href="/favicon.ico" type="image/x-icon" />
- <link rel="manifest" href="/manifest.json">
2019-08-10 07:50:05 +08:00
+ <link rel="icon" href="./favicon.ico" type="image/x-icon" />
+ <link rel="manifest" href="./manifest.json">
+ <link rel="apple-touch-icon" href="./static/out/vs/server/src/media/code-server.png" />
<link data-name="vs/workbench/workbench.web.api" rel="stylesheet" href="./static/out/vs/workbench/workbench.web.api.css">
</head>
2019-07-23 05:00:59 +08:00
diff --git a/src/vs/code/browser/workbench/workbench.js b/src/vs/code/browser/workbench/workbench.js
2019-09-07 06:41:22 +08:00
index 2f09f53e43..0f5eef1c9e 100644
2019-07-23 05:00:59 +08:00
--- a/src/vs/code/browser/workbench/workbench.js
+++ b/src/vs/code/browser/workbench/workbench.js
2019-09-07 06:41:22 +08:00
@@ -8,24 +8,53 @@
2019-07-23 05:00:59 +08:00
(function () {
+ const basePath = window.location.pathname.replace(/\/+$/, '');
+ const base = window.location.origin + basePath;
2019-09-07 06:41:22 +08:00
+ const options = JSON.parse(document.getElementById('vscode-workbench-web-configuration').getAttribute('data-settings'));
+ options.webviewEndpoint = `${base}/webview/`;
2019-08-14 23:25:31 +08:00
+ let nlsConfig;
+ try {
+ nlsConfig = JSON.parse(document.getElementById('vscode-remote-nls-configuration').getAttribute('data-settings'));
+ if (nlsConfig._resolvedLanguagePackCoreLocation) {
+ const bundles = Object.create(null);
+ nlsConfig.loadBundle = (bundle, language, cb) => {
+ let result = bundles[bundle];
+ if (result) {
+ return cb(undefined, result);
+ }
+ // FIXME: Only works if path separators are /.
+ const path = nlsConfig._resolvedLanguagePackCoreLocation
+ + '/' + bundle.replace(/\//g, '!') + '.nls.json';
+ fetch(`${base}/resource/?path=${encodeURIComponent(path)}`)
2019-08-14 23:25:31 +08:00
+ .then((response) => response.json())
+ .then((json) => {
+ bundles[bundle] = json;
+ cb(undefined, json);
+ })
+ .catch(cb);
+ };
+ }
+ } catch (error) { /* Probably fine. */ }
+
/** @type any */
const amdLoader = require;
2019-09-07 06:41:22 +08:00
+ const staticBase = base + `/static${options.productConfiguration && options.productConfiguration.commit ? `-${options.productConfiguration.commit}` : ''}`;
amdLoader.config({
- baseUrl: `${window.location.origin}/static/out`,
2019-09-07 06:41:22 +08:00
+ baseUrl: `${staticBase}/out`,
2019-07-23 05:00:59 +08:00
paths: {
- 'vscode-textmate': `${window.location.origin}/static/node_modules/vscode-textmate/release/main`,
- 'onigasm-umd': `${window.location.origin}/static/node_modules/onigasm-umd/release/main`,
- 'xterm': `${window.location.origin}/static/node_modules/xterm/lib/xterm.js`,
- 'xterm-addon-search': `${window.location.origin}/static/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
- 'xterm-addon-web-links': `${window.location.origin}/static/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`,
- 'semver-umd': `${window.location.origin}/static/node_modules/semver-umd/lib/semver-umd.js`,
- '@microsoft/applicationinsights-web': `${window.location.origin}/static/node_modules/@microsoft/applicationinsights-web/dist/applicationinsights-web.js`,
2019-08-14 23:25:31 +08:00
- }
2019-09-07 06:41:22 +08:00
+ 'vscode-textmate': `${staticBase}/node_modules/vscode-textmate/release/main`,
+ 'onigasm-umd': `${staticBase}/node_modules/onigasm-umd/release/main`,
+ 'xterm': `${staticBase}/node_modules/xterm/lib/xterm.js`,
+ 'xterm-addon-search': `${staticBase}/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
+ 'xterm-addon-web-links': `${staticBase}/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`,
+ 'semver-umd': `${staticBase}/node_modules/semver-umd/lib/semver-umd.js`,
+ '@microsoft/applicationinsights-web': `${staticBase}/node_modules/@microsoft/applicationinsights-web/dist/applicationinsights-web.js`,
2019-08-14 23:25:31 +08:00
+ },
+ 'vs/nls': nlsConfig
2019-07-23 05:00:59 +08:00
});
amdLoader(['vs/workbench/workbench.web.api'], function (api) {
2019-09-07 06:41:22 +08:00
- const options = JSON.parse(document.getElementById('vscode-workbench-web-configuration').getAttribute('data-settings'));
2019-08-12 23:23:08 +08:00
api.create(document.body, options);
});
})();
diff --git a/src/vs/platform/environment/common/environment.ts b/src/vs/platform/environment/common/environment.ts
2019-09-13 01:49:28 +08:00
index 3b45568e1b..aebe04ccfe 100644
--- a/src/vs/platform/environment/common/environment.ts
+++ b/src/vs/platform/environment/common/environment.ts
@@ -82,6 +82,8 @@ export interface ParsedArgs {
2019-08-10 07:50:05 +08:00
// Web flags
'web-user-data-dir'?: string;
+ 'extra-extensions-dir'?: string | string[];
+ 'extra-builtin-extensions-dir'?: string | string[];
}
export const IEnvironmentService = createDecorator<IEnvironmentService>('environmentService');
@@ -162,4 +164,6 @@ export interface IEnvironmentService {
driverVerbose: boolean;
2019-08-10 07:50:05 +08:00
galleryMachineIdResource?: URI;
+ extraExtensionPaths: string[];
+ extraBuiltinExtensionPaths: string[];
}
diff --git a/src/vs/platform/environment/node/environmentService.ts b/src/vs/platform/environment/node/environmentService.ts
2019-09-13 01:49:28 +08:00
index a07c4c8f48..028ed19657 100644
--- a/src/vs/platform/environment/node/environmentService.ts
+++ b/src/vs/platform/environment/node/environmentService.ts
2019-09-13 01:49:28 +08:00
@@ -264,6 +264,15 @@ export class EnvironmentService implements IEnvironmentService {
get driverHandle(): string | undefined { return this._args['driver']; }
get driverVerbose(): boolean { return !!this._args['driver-verbose']; }
2019-08-10 07:50:05 +08:00
+ @memoize get extraExtensionPaths(): string[] {
+ return this.arrayify(this._args['extra-extensions-dir']).map((p) => <string>parsePathArg(p, process));
+ }
2019-08-10 07:50:05 +08:00
+ @memoize get extraBuiltinExtensionPaths(): string[] {
+ return this.arrayify(this._args['extra-builtin-extensions-dir']).map((p) => <string>parsePathArg(p, process));
+ }
2019-08-10 07:50:05 +08:00
+ private arrayify<T>(arg: T | T[] = []): T[] {
+ return (Array.isArray(arg) ? arg : [arg]).filter((p) => !!p);
2019-08-10 07:50:05 +08: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-09-13 01:49:28 +08:00
index 7d0b568fc7..23ab257b42 100644
--- a/src/vs/platform/extensionManagement/node/extensionManagementService.ts
+++ b/src/vs/platform/extensionManagement/node/extensionManagementService.ts
@@ -731,11 +731,15 @@ export class ExtensionManagementService extends Disposable implements IExtension
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), []);
+ this.logService.info('Scanned system extensions:', result.length);
+ return result;
+ });
if (this.environmentService.isBuilt) {
return systemExtensionsPromise;
}
@@ -757,9 +761,16 @@ export class ExtensionManagementService extends Disposable implements IExtension
.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) {
@@ -774,6 +785,12 @@ export class ExtensionManagementService extends Disposable implements IExtension
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));
}
@@ -812,7 +829,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
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()]) {
@@ -831,7 +848,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
}
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[] = [];
diff --git a/src/vs/platform/localizations/electron-browser/localizationsService.ts b/src/vs/platform/localizations/electron-browser/localizationsService.ts
2019-09-13 01:49:28 +08:00
index add4dfb2fc..18fc71df51 100644
--- a/src/vs/platform/localizations/electron-browser/localizationsService.ts
+++ b/src/vs/platform/localizations/electron-browser/localizationsService.ts
2019-08-10 07:50:05 +08:00
@@ -6,7 +6,7 @@
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { Event } from 'vs/base/common/event';
import { ILocalizationsService, LanguageType } from 'vs/platform/localizations/common/localizations';
-import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
+import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
2019-09-13 01:49:28 +08:00
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
export class LocalizationsService implements ILocalizationsService {
2019-09-13 01:49:28 +08:00
@@ -15,8 +15,8 @@ export class LocalizationsService implements ILocalizationsService {
private channel: IChannel;
- constructor(@ISharedProcessService sharedProcessService: ISharedProcessService) {
- this.channel = sharedProcessService.getChannel('localizations');
2019-08-10 07:50:05 +08:00
+ constructor(@IRemoteAgentService remoteAgentService: IRemoteAgentService) {
+ this.channel = remoteAgentService.getConnection()!.getChannel('localizations');
}
get onDidLanguagesChange(): Event<void> { return this.channel.listen('onDidLanguagesChange'); }
2019-07-17 03:57:02 +08:00
diff --git a/src/vs/platform/log/common/logIpc.ts b/src/vs/platform/log/common/logIpc.ts
2019-09-13 01:49:28 +08:00
index 9f68b645b6..1e224cc29a 100644
2019-07-17 03:57:02 +08:00
--- a/src/vs/platform/log/common/logIpc.ts
+++ b/src/vs/platform/log/common/logIpc.ts
@@ -26,6 +26,7 @@ export class LogLevelSetterChannel implements IServerChannel {
call(_: unknown, command: string, arg?: any): Promise<any> {
switch (command) {
case 'setLevel': this.service.setLevel(arg); return Promise.resolve();
+ case 'getLevel': return Promise.resolve(this.service.getLevel());
}
throw new Error(`Call not found: ${command}`);
@@ -43,6 +44,10 @@ export class LogLevelSetterChannelClient {
2019-08-10 07:50:05 +08:00
setLevel(level: LogLevel): void {
this.channel.call('setLevel', level);
2019-07-17 03:57:02 +08:00
}
+
2019-07-17 03:57:02 +08:00
+ getLevel(): Promise<LogLevel> {
+ return this.channel.call('getLevel');
+ }
2019-08-10 07:50:05 +08:00
}
export class FollowerLogService extends DelegatedLogService implements ILogService {
2019-08-08 05:18:17 +08:00
diff --git a/src/vs/platform/product/node/package.ts b/src/vs/platform/product/node/package.ts
index d39c5877d6..c189d6f19f 100644
--- a/src/vs/platform/product/node/package.ts
+++ b/src/vs/platform/product/node/package.ts
@@ -9,6 +9,7 @@ import { getPathFromAmdModule } from 'vs/base/common/amd';
export interface IPackageConfiguration {
name: string;
version: string;
+ codeServerVersion: string;
}
const rootPath = path.dirname(getPathFromAmdModule(require, ''));
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
index 6b24ec0781..43dd9c12c8 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
@@ -133,7 +133,7 @@ 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`);
+ 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();
@@ -141,6 +141,3 @@ export class BrowserSocketFactory implements ISocketFactory {
});
}
}
-
-
-
2019-08-08 05:18:17 +08:00
diff --git a/src/vs/platform/update/electron-browser/updateService.ts b/src/vs/platform/update/electron-browser/updateService.ts
2019-09-13 01:49:28 +08:00
index bd8fa6cc18..cf6108a57b 100644
2019-08-08 05:18:17 +08:00
--- a/src/vs/platform/update/electron-browser/updateService.ts
+++ b/src/vs/platform/update/electron-browser/updateService.ts
2019-08-10 07:50:05 +08:00
@@ -6,7 +6,7 @@
2019-08-08 05:18:17 +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 { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
2019-09-13 01:49:28 +08:00
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
2019-08-08 05:18:17 +08:00
export class UpdateService implements IUpdateService {
2019-09-13 01:49:28 +08:00
@@ -21,8 +21,8 @@ export class UpdateService implements IUpdateService {
2019-08-08 05:18:17 +08:00
private channel: IChannel;
- constructor(@IMainProcessService mainProcessService: IMainProcessService) {
- this.channel = mainProcessService.getChannel('update');
2019-08-10 07:50:05 +08:00
+ constructor(@IRemoteAgentService mainProcessService: IRemoteAgentService) {
+ this.channel = mainProcessService.getConnection()!.getChannel('update');
2019-08-08 05:18:17 +08:00
// always set this._state as the state changes
this.onStateChange(state => this._state = state);
diff --git a/src/vs/platform/update/electron-main/abstractUpdateService.ts b/src/vs/platform/update/electron-main/abstractUpdateService.ts
2019-09-13 01:49:28 +08:00
index d789bf4e09..e25c9c9d6a 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';
-import { ILifecycleService } from 'vs/platform/lifecycle/electron-main/lifecycleMain';
import product from 'vs/platform/product/node/product';
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(
- @ILifecycleService private readonly lifecycleService: ILifecycleService,
+ _placeholder: any, // To prevent errors from the extending classes.
@IConfigurationService protected configurationService: IConfigurationService,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@IRequestService protected requestService: IRequestService,
2019-08-10 07:50:05 +08:00
@@ -55,7 +54,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
2019-08-08 05:18:17 +08:00
return;
}
- if (!product.updateUrl || !product.commit) {
2019-08-10 07:50:05 +08:00
+ if (!product.commit) {
2019-08-08 05:18:17 +08:00
this.logService.info('update#ctor - updates are disabled as there is no update URL');
return;
}
@@ -93,7 +92,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
2019-08-08 05:18:17 +08:00
}
private getProductQuality(updateMode: string): string | undefined {
- return updateMode === 'none' ? undefined : product.quality;
2019-08-10 07:50:05 +08:00
+ return updateMode === 'none' ? undefined : 'unused';
2019-08-08 05:18:17 +08:00
}
private scheduleCheckForUpdates(delay = 60 * 60 * 1000): Promise<void> {
@@ -152,15 +151,15 @@ export abstract class AbstractUpdateService implements IUpdateService {
2019-08-08 05:18:17 +08:00
this.logService.trace('update#quitAndInstall(): before lifecycle quit()');
- this.lifecycleService.quit(true /* from update */).then(vetod => {
- this.logService.trace(`update#quitAndInstall(): after lifecycle quit() with veto: ${vetod}`);
- if (vetod) {
- return;
- }
2019-08-10 07:50:05 +08:00
+ // this.lifecycleService.quit(true /* from update */).then(vetod => {
+ // this.logService.trace(`update#quitAndInstall(): after lifecycle quit() with veto: ${vetod}`);
+ // if (vetod) {
+ // return;
+ // }
2019-08-08 05:18:17 +08:00
this.logService.trace('update#quitAndInstall(): running raw#quitAndInstall()');
this.doQuitAndInstall();
- });
+ // });
return Promise.resolve(undefined);
}
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
index c5fd74ffe7..e972b03f79 100644
--- a/src/vs/workbench/api/common/extHost.api.impl.ts
+++ b/src/vs/workbench/api/common/extHost.api.impl.ts
@@ -68,6 +68,7 @@ import { ILogService } from 'vs/platform/log/common/log';
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;
@@ -87,6 +88,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
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);
@@ -94,6 +96,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
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
index a6ac9b8086..c0027b8f74 100644
--- a/src/vs/workbench/api/common/extHost.protocol.ts
+++ b/src/vs/workbench/api/common/extHost.protocol.ts
@@ -614,6 +614,10 @@ export interface MainThreadLabelServiceShape extends IDisposable {
$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;
@@ -844,6 +848,13 @@ export interface ExtHostLabelServiceShape {
$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>;
@@ -1351,7 +1362,8 @@ export const MainContext = {
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 = {
@@ -1385,5 +1397,6 @@ export const ExtHostContext = {
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
index 8c903a6027..7199c1e467 100644
--- 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` */
@@ -75,6 +76,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
protected readonly _extHostWorkspace: ExtHostWorkspace;
protected readonly _extHostConfiguration: ExtHostConfiguration;
protected readonly _logService: ILogService;
+ protected readonly _nodeProxy: IExtHostNodeProxy;
protected readonly _mainThreadWorkspaceProxy: MainThreadWorkspaceShape;
protected readonly _mainThreadTelemetryProxy: MainThreadTelemetryShape;
@@ -103,7 +105,8 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
@IExtHostConfiguration extHostConfiguration: IExtHostConfiguration,
@ILogService logService: ILogService,
@IExtHostInitDataService initData: IExtHostInitDataService,
- @IExtensionStoragePaths storagePath: IExtensionStoragePaths
+ @IExtensionStoragePaths storagePath: IExtensionStoragePaths,
+ @IExtHostNodeProxy nodeProxy: IExtHostNodeProxy,
) {
this._hostUtils = hostUtils;
this._extHostContext = extHostContext;
@@ -112,6 +115,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
this._extHostWorkspace = extHostWorkspace;
this._extHostConfiguration = extHostConfiguration;
this._logService = logService;
+ this._nodeProxy = nodeProxy;
this._disposables = new DisposableStore();
this._mainThreadWorkspaceProxy = this._extHostContext.getProxy(MainContext.MainThreadWorkspace);
@@ -331,15 +335,15 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
this._logService.info(`ExtensionService#_doActivateExtension ${extensionDescription.identifier.value} ${JSON.stringify(reason)}`);
const activationTimesBuilder = new ExtensionActivationTimesBuilder(reason.startup);
- return Promise.all<any>([
- this._loadCommonJSModule(joinPath(extensionDescription.extensionLocation, extensionDescription.main), activationTimesBuilder),
+ return Promise.all([
+ this._loadCommonJSModule<IExtensionModule>(extensionDescription, activationTimesBuilder),
this._loadExtensionContext(extensionDescription)
]).then(values => {
return AbstractExtHostExtensionService._callActivate(this._logService, extensionDescription.identifier, <IExtensionModule>values[0], <IExtensionContext>values[1], activationTimesBuilder);
});
}
- 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
index 8e96e6738e..5a3a48101a 100644
--- 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
index 4fcb6db76f..840ac56c3b 100644
--- a/src/vs/workbench/api/worker/extHostExtensionService.ts
+++ b/src/vs/workbench/api/worker/extHostExtensionService.ts
@@ -10,6 +10,9 @@ import { endsWith, startsWith } from 'vs/base/common/strings';
import { URI } from 'vs/base/common/uri';
import { joinPath } from 'vs/base/common/resources';
import { RequireInterceptor } from 'vs/workbench/api/common/extHostRequireInterceptor';
+import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
+import { fromTar } from 'vs/server/node_modules/@coder/requirefs/out/src/requirefs';
+import { Client } from 'vs/server/node_modules/@coder/node-browser/out/client/client';
class ExportsTrap {
@@ -105,7 +108,44 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService {
await this._fakeModules.install();
}
- protected _loadCommonJSModule<T>(module: URI, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise<T> {
+ protected async _loadCommonJSModule<T>(module: URI | IExtensionDescription, activationTimesBuilder: ExtensionActivationTimesBuilder): Promise<T> {
+ if (!URI.isUri(module) && module.extensionKind !== 'web') {
+ const fetchUri = URI.from({
+ scheme: self.location.protocol.replace(':', ''),
+ authority: self.location.host,
+ path: `${self.location.pathname.replace(/\/static\/out\/vs\/workbench\/services\/extensions\/worker\/extensionHostWorkerMain.js$/, '')}/tar`,
+ query: `path=${encodeURIComponent(module.extensionLocation.path)}`,
+ });
+ const response = await fetch(fetchUri.toString(true));
+ if (response.status !== 200) {
+ throw new Error(`Failed to download extension '${module.extensionLocation.path}'`);
+ }
+ const client = new Client(this._nodeProxy, { logger: this._logService });
+ const init = await client.handshake();
+ const buffer = new Uint8Array(await response.arrayBuffer());
+ const rfs = fromTar(buffer);
+ (<any>self).global = self;
+ rfs.provide('vscode', this._fakeModules.getModule('vscode', module.extensionLocation));
+ Object.keys(client.modules).forEach((key) => {
+ const mod = (client.modules as any)[key];
+ if (key === 'process') {
+ (<any>self).process = mod;
+ (<any>self).process.env = init.env;
+ return;
+ }
+
+ rfs.provide(key, mod);
+ switch (key) {
+ case 'buffer':
+ (<any>self).Buffer = mod.Buffer;
+ break;
+ case 'timers':
+ (<any>self).setImmediate = mod.setImmediate;
+ break;
+ }
+ });
+ return rfs.require('.');
+ }
(<any>self).window = self; // <- that's improper but might help extensions that aren't authored correctly
@@ -132,6 +172,9 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService {
return trap.claim();
};
+ if (!URI.isUri(module)) {
+ module = joinPath(module.extensionLocation, module.main!);
+ }
try {
activationTimesBuilder.codeLoadingStart();
2019-07-20 04:10:43 +08:00
diff --git a/src/vs/workbench/browser/dnd.ts b/src/vs/workbench/browser/dnd.ts
index b99f800164..bf44f1d9c4 100644
2019-07-20 04:10:43 +08:00
--- a/src/vs/workbench/browser/dnd.ts
+++ b/src/vs/workbench/browser/dnd.ts
2019-08-10 07:50:05 +08:00
@@ -32,6 +32,7 @@ import { IRecentFile } from 'vs/platform/history/common/history';
2019-07-20 04:10:43 +08:00
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
import { withNullAsUndefined } from 'vs/base/common/types';
2019-08-10 07:50:05 +08:00
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
+import { IUploadService } from 'vs/server/src/browser/upload';
2019-07-20 04:10:43 +08:00
export interface IDraggedResource {
resource: URI;
@@ -166,14 +167,15 @@ export class ResourcesDropHandler {
@IUntitledEditorService private readonly untitledEditorService: IUntitledEditorService,
@IEditorService private readonly editorService: IEditorService,
@IConfigurationService private readonly configurationService: IConfigurationService,
- @IWorkspaceEditingService private readonly workspaceEditingService: IWorkspaceEditingService
+ @IWorkspaceEditingService private readonly workspaceEditingService: IWorkspaceEditingService,
+ @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-08-24 03:54:39 +08:00
diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts
2019-09-13 01:49:28 +08:00
index 2e1e63986f..563c4b2472 100644
2019-08-24 03:54:39 +08:00
--- a/src/vs/workbench/browser/layout.ts
+++ b/src/vs/workbench/browser/layout.ts
@@ -260,7 +260,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
2019-08-24 03:54:39 +08:00
if (visible !== this.state.menuBar.toggled) {
this.state.menuBar.toggled = visible;
- if (this.state.fullscreen && (this.state.menuBar.visibility === 'toggle' || this.state.menuBar.visibility === 'default')) {
+ if (this.state.menuBar.visibility === 'toggle' || (this.state.fullscreen && this.state.menuBar.visibility === 'default')) {
this._onTitleBarVisibilityChange.fire();
if (this.workbenchGrid instanceof SerializableGrid) {
@@ -563,13 +563,13 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
2019-08-24 03:54:39 +08:00
case Parts.TITLEBAR_PART:
if (getTitleBarStyle(this.configurationService, this.environmentService) === 'native') {
return false;
- } else if (!this.state.fullscreen) {
- return true;
+ } else if (this.state.menuBar.visibility === 'default') {
+ return !this.state.fullscreen || this.state.menuBar.toggled;
} else if (isMacintosh && isNative) {
return false;
} else if (this.state.menuBar.visibility === 'visible') {
return true;
- } else if (this.state.menuBar.visibility === 'toggle' || this.state.menuBar.visibility === 'default') {
+ } else if (this.state.menuBar.visibility === 'toggle') {
return this.state.menuBar.toggled;
}
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
index f5944ce974..66bedce55c 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
@@ -45,6 +45,7 @@ import { FileLogService } from 'vs/platform/log/common/fileLogService';
import { toLocalISOString } from 'vs/base/common/date';
import { IndexedDBLogProvider } from 'vs/workbench/services/log/browser/indexedDBLogProvider';
import { InMemoryLogProvider } from 'vs/workbench/services/log/common/inMemoryLogProvider';
+import { initialize } from 'vs/server/src/browser/client';
2019-07-18 00:57:26 +08:00
class CodeRendererMain extends Disposable {
2019-09-04 05:38:53 +08:00
@@ -94,6 +95,7 @@ class CodeRendererMain extends Disposable {
2019-07-18 00:57:26 +08:00
2019-09-04 05:38:53 +08:00
// Startup
workbench.startup();
+ await initialize(services.serviceCollection);
2019-09-04 05:38:53 +08:00
}
2019-07-18 00:57:26 +08:00
2019-09-04 05:38:53 +08:00
private restoreBaseTheme(): void {
@@ -204,6 +206,7 @@ class CodeRendererMain extends Disposable {
const channel = connection.getChannel<IChannel>(REMOTE_FILE_SYSTEM_CHANNEL_NAME);
2019-07-11 05:29:15 +08:00
const remoteFileSystemProvider = this._register(new RemoteExtensionsFileSystemProvider(channel, remoteAgentService.getEnvironment()));
2019-08-10 07:50:05 +08:00
fileService.registerProvider(Schemas.vscodeRemote, remoteFileSystemProvider);
2019-07-13 06:13:49 +08:00
+ fileService.registerProvider(Schemas.file, remoteFileSystemProvider);
2019-07-13 08:09:07 +08:00
if (!this.configuration.userDataProvider) {
2019-08-10 07:50:05 +08:00
const remoteUserDataUri = this.getRemoteUserDataUri();
2019-07-11 05:29:15 +08:00
diff --git a/src/vs/workbench/browser/web.simpleservices.ts b/src/vs/workbench/browser/web.simpleservices.ts
index 895a8a0393..e9fa627fba 100644
2019-07-11 05:29:15 +08:00
--- a/src/vs/workbench/browser/web.simpleservices.ts
+++ b/src/vs/workbench/browser/web.simpleservices.ts
@@ -33,6 +33,7 @@ import { localize } from 'vs/nls';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
// tslint:disable-next-line: import-patterns
import { IWorkspaceStatsService, Tags } from 'vs/workbench/contrib/stats/common/workspaceStats';
+import { withQuery } from 'vs/server/src/browser/client';
2019-07-13 08:09:07 +08:00
//#region Update
2019-07-13 08:09:07 +08:00
@@ -64,7 +65,7 @@ export class SimpleUpdateService implements IUpdateService {
2019-08-08 05:18:17 +08:00
}
}
-registerSingleton(IUpdateService, SimpleUpdateService);
+// registerSingleton(IUpdateService, SimpleUpdateService);
//#endregion
@@ -285,7 +286,10 @@ export class SimpleWindowService extends Disposable implements IWindowService {
2019-07-24 03:55:48 +08:00
for (let i = 0; i < _uris.length; i++) {
const uri = _uris[i];
if ('folderUri' in uri) {
- const newAddress = `${document.location.origin}/?folder=${uri.folderUri.path}`;
+ const newAddress = withQuery(window.location.toString(), {
+ folder: uri.folderUri.path,
+ workspace: undefined,
+ });
2019-07-24 03:55:48 +08:00
if (openFolderInNewWindow) {
window.open(newAddress);
} else {
@@ -293,7 +297,10 @@ export class SimpleWindowService extends Disposable implements IWindowService {
2019-07-24 03:55:48 +08:00
}
}
if ('workspaceUri' in uri) {
- const newAddress = `${document.location.origin}/?workspace=${uri.workspaceUri.path}`;
+ const newAddress = withQuery(window.location.toString(), {
+ folder: undefined,
+ workspace: uri.workspaceUri.path,
+ });
2019-07-24 03:55:48 +08:00
if (openFolderInNewWindow) {
window.open(newAddress);
} else {
diff --git a/src/vs/workbench/buildfile.web.js b/src/vs/workbench/buildfile.web.js
index 47a8453302..4a7a8c7775 100644
--- a/src/vs/workbench/buildfile.web.js
+++ b/src/vs/workbench/buildfile.web.js
@@ -20,5 +20,8 @@ function createModuleDescription(name, exclude) {
exports.collectModules = function () {
return [
createModuleDescription('vs/workbench/contrib/output/common/outputLinkComputer', ['vs/base/common/worker/simpleWorker', 'vs/editor/common/services/editorSimpleWorker']),
+ createModuleDescription('vs/platform/files/node/watcher/unix/watcherApp', []),
+ createModuleDescription('vs/platform/files/node/watcher/nsfw/watcherApp', []),
+ createModuleDescription('vs/workbench/services/extensions/node/extensionHostProcess', []),
];
};
2019-07-20 04:10:43 +08:00
diff --git a/src/vs/workbench/contrib/files/browser/files.contribution.ts b/src/vs/workbench/contrib/files/browser/files.contribution.ts
index 19fcd5b0ac..30df54ac1a 100644
2019-07-20 04:10:43 +08:00
--- a/src/vs/workbench/contrib/files/browser/files.contribution.ts
+++ b/src/vs/workbench/contrib/files/browser/files.contribution.ts
2019-08-10 07:50:05 +08:00
@@ -224,7 +224,7 @@ configurationRegistry.registerConfiguration({
2019-07-20 04:10:43 +08: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
index 0c368120df..6396d2316b 100644
2019-07-20 04:10:43 +08:00
--- a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts
+++ b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts
@@ -47,6 +47,7 @@ import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/work
2019-07-20 04:10:43 +08:00
import { findValidPasteFileTarget } from 'vs/workbench/contrib/files/browser/fileActions';
import { FuzzyScore, createMatches } from 'vs/base/common/filters';
import { Emitter } from 'vs/base/common/event';
+import { IUploadService } from 'vs/server/src/browser/upload';
2019-07-20 04:10:43 +08:00
export class ExplorerDelegate implements IListVirtualDelegate<ExplorerItem> {
@@ -450,7 +451,8 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
2019-07-20 04:10:43 +08:00
@IInstantiationService private instantiationService: IInstantiationService,
@ITextFileService private textFileService: ITextFileService,
@IWindowService private windowService: IWindowService,
- @IWorkspaceEditingService private workspaceEditingService: IWorkspaceEditingService
+ @IWorkspaceEditingService private workspaceEditingService: IWorkspaceEditingService,
+ @IUploadService private readonly uploadService: IUploadService,
) {
this.toDispose = [];
@@ -612,6 +614,7 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
2019-07-20 04:10:43 +08: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-07-17 03:57:02 +08:00
diff --git a/src/vs/workbench/contrib/remote/common/remote.contribution.ts b/src/vs/workbench/contrib/remote/common/remote.contribution.ts
2019-09-13 01:49:28 +08:00
index 404f5a2a78..a04c825fa2 100644
2019-07-17 03:57:02 +08:00
--- a/src/vs/workbench/contrib/remote/common/remote.contribution.ts
+++ b/src/vs/workbench/contrib/remote/common/remote.contribution.ts
2019-09-13 01:49:28 +08:00
@@ -79,7 +79,8 @@ class RemoteChannelsContribution extends Disposable implements IWorkbenchContrib
2019-07-17 03:57:02 +08:00
const connection = remoteAgentService.getConnection();
if (connection) {
const logLevelClient = new LogLevelSetterChannelClient(connection.getChannel('loglevel'));
- logLevelClient.setLevel(logService.getLevel());
+ logLevelClient.getLevel().then((level) => logService.setLevel(level));
+ logLevelClient.onDidChangeLogLevel((level) => logService.setLevel(level));
this._register(logService.onDidChangeLogLevel(level => logLevelClient.setLevel(level)));
}
}
diff --git a/src/vs/workbench/contrib/resources/browser/resourceServiceWorker.ts b/src/vs/workbench/contrib/resources/browser/resourceServiceWorker.ts
2019-09-13 01:49:28 +08:00
index 3534ef147d..773f711863 100644
--- a/src/vs/workbench/contrib/resources/browser/resourceServiceWorker.ts
+++ b/src/vs/workbench/contrib/resources/browser/resourceServiceWorker.ts
2019-09-13 01:49:28 +08:00
@@ -34,7 +34,8 @@ self.addEventListener('activate', event => {
//#region --- fetching/caching
const _cacheName = 'vscode-extension-resources';
-const _resourcePrefix = '/vscode-remote-resource';
2019-09-04 06:24:14 +08:00
+const rootPath = (<any>self).location.pathname.replace(/\/out\/vs\/workbench\/contrib\/resources\/browser\/resourceServiceWorkerMain.js$/, '');
+const _resourcePrefix = `${rootPath}/vscode-remote-resources`;
const _pendingFetch = new Map<string, Function>();
self.addEventListener('message', event => {
diff --git a/src/vs/workbench/contrib/resources/browser/resourceServiceWorkerClient.ts b/src/vs/workbench/contrib/resources/browser/resourceServiceWorkerClient.ts
2019-09-13 01:49:28 +08:00
index 326dfb49ee..adf72747bd 100644
--- a/src/vs/workbench/contrib/resources/browser/resourceServiceWorkerClient.ts
+++ b/src/vs/workbench/contrib/resources/browser/resourceServiceWorkerClient.ts
2019-09-13 01:49:28 +08:00
@@ -18,7 +18,11 @@ class ResourceServiceWorker {
constructor(
@ILogService private readonly _logService: ILogService,
) {
- navigator.serviceWorker.register(ResourceServiceWorker._url, { scope: '/' }).then(reg => {
+ if (!navigator.serviceWorker) {
+ console.warn('Service workers are not enabled.');
+ return;
+ }
+ navigator.serviceWorker.register(ResourceServiceWorker._url, { scope: window.location.pathname.replace(/\/+$/, '') }).then(reg => {
this._logService.trace('SW#reg', reg);
return reg.update();
}).then(() => {
2019-09-13 01:49:28 +08:00
@@ -45,5 +49,3 @@ Registry.as<IWorkbenchContributionsRegistry>(Extensions.Workbench).registerWorkb
ResourceServiceWorker,
LifecyclePhase.Ready
);
-
-
2019-08-08 05:18:17 +08:00
diff --git a/src/vs/workbench/contrib/update/electron-browser/update.contribution.ts b/src/vs/workbench/contrib/update/electron-browser/update.contribution.ts
index e39fa57979..c7e1113846 100644
2019-08-08 05:18:17 +08:00
--- a/src/vs/workbench/contrib/update/electron-browser/update.contribution.ts
+++ b/src/vs/workbench/contrib/update/electron-browser/update.contribution.ts
2019-08-10 07:50:05 +08:00
@@ -4,26 +4,11 @@
2019-08-08 05:18:17 +08:00
*--------------------------------------------------------------------------------------------*/
import 'vs/platform/update/node/update.config.contribution';
-import * as platform from 'vs/base/common/platform';
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
-import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
-import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
-import { ShowCurrentReleaseNotesAction, ProductContribution, UpdateContribution, Win3264BitContribution } from './update';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
+import { UpdateContribution } from 'vs/workbench/contrib/update/electron-browser/update';
2019-08-08 05:18:17 +08:00
const workbench = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
-workbench.registerWorkbenchContribution(ProductContribution, LifecyclePhase.Restored);
2019-08-10 07:50:05 +08:00
-
-if (platform.isWindows) {
- if (process.arch === 'ia32') {
- workbench.registerWorkbenchContribution(Win3264BitContribution, LifecyclePhase.Restored);
- }
2019-08-08 05:18:17 +08:00
-}
2019-08-10 07:50:05 +08:00
-
2019-08-08 05:18:17 +08:00
workbench.registerWorkbenchContribution(UpdateContribution, LifecyclePhase.Restored);
2019-08-10 07:50:05 +08:00
-
-// Editor
2019-08-08 05:18:17 +08:00
-Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions)
- .registerWorkbenchAction(new SyncActionDescriptor(ShowCurrentReleaseNotesAction, ShowCurrentReleaseNotesAction.ID, ShowCurrentReleaseNotesAction.LABEL), 'Show Release Notes');
diff --git a/src/vs/workbench/contrib/update/electron-browser/update.ts b/src/vs/workbench/contrib/update/electron-browser/update.ts
index d429d21347..32559b70f0 100644
2019-08-08 05:18:17 +08:00
--- a/src/vs/workbench/contrib/update/electron-browser/update.ts
+++ b/src/vs/workbench/contrib/update/electron-browser/update.ts
@@ -5,36 +5,24 @@
import * as nls from 'vs/nls';
2019-08-08 05:18:17 +08:00
import severity from 'vs/base/common/severity';
-import { Action } from 'vs/base/common/actions';
2019-08-10 07:50:05 +08:00
import { Disposable, MutableDisposable } from 'vs/base/common/lifecycle';
2019-08-08 05:18:17 +08:00
-import pkg from 'vs/platform/product/node/package';
-import product from 'vs/platform/product/node/product';
-import { URI } from 'vs/base/common/uri';
import { IActivityService, NumberBadge, IBadge, ProgressBadge } from 'vs/workbench/services/activity/common/activity';
-import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { GLOBAL_ACTIVITY_ID } from 'vs/workbench/common/activity';
-import { IOpenerService } from 'vs/platform/opener/common/opener';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IUpdateService, State as UpdateState, StateType, IUpdate } from 'vs/platform/update/common/update';
2019-08-10 07:50:05 +08:00
-import * as semver from 'semver-umd';
2019-08-08 05:18:17 +08:00
-import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
2019-08-08 05:18:17 +08:00
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
-import { ReleaseNotesManager } from './releaseNotesEditor';
-import { isWindows } from 'vs/base/common/platform';
-import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { RawContextKey, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { FalseContext } from 'vs/platform/contextkey/common/contextkeys';
2019-08-10 07:50:05 +08:00
-import { ShowCurrentReleaseNotesActionId } from 'vs/workbench/contrib/update/common/update';
-import { IWindowService, IWindowsService } from 'vs/platform/windows/common/windows';
2019-08-08 05:18:17 +08:00
+import { IProductService } from 'vs/platform/product/common/product';
const CONTEXT_UPDATE_STATE = new RawContextKey<string>('updateState', StateType.Uninitialized);
-let releaseNotesManager: ReleaseNotesManager | undefined = undefined;
+/*let releaseNotesManager: ReleaseNotesManager | undefined = undefined;
function showReleaseNotes(instantiationService: IInstantiationService, version: string) {
if (!releaseNotesManager) {
@@ -190,7 +178,7 @@ export class Win3264BitContribution implements IWorkbenchContribution {
}
2019-08-08 05:18:17 +08:00
);
}
-}
2019-08-10 07:50:05 +08:00
+}*/
2019-08-08 05:18:17 +08:00
export class UpdateContribution extends Disposable implements IWorkbenchContribution {
@@ -200,13 +188,13 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-08 05:18:17 +08:00
constructor(
@IStorageService private readonly storageService: IStorageService,
- @IInstantiationService private readonly instantiationService: IInstantiationService,
@INotificationService private readonly notificationService: INotificationService,
@IDialogService private readonly dialogService: IDialogService,
@IUpdateService private readonly updateService: IUpdateService,
2019-08-10 07:50:05 +08:00
@IActivityService private readonly activityService: IActivityService,
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
- @IContextKeyService private readonly contextKeyService: IContextKeyService
+ @IContextKeyService private readonly contextKeyService: IContextKeyService,
+ @IProductService private readonly productService: IProductService,
) {
super();
this.state = updateService.state;
@@ -223,7 +211,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-08 05:18:17 +08:00
updated since 5 days.
*/
- const currentVersion = product.commit;
+ const currentVersion = this.productService.commit;
const lastKnownVersion = this.storageService.get('update/lastKnownVersion', StorageScope.GLOBAL);
// if current version != stored version, clear both fields
@@ -268,9 +256,9 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-08 05:18:17 +08:00
let clazz: string | undefined;
if (state.type === StateType.AvailableForDownload || state.type === StateType.Downloaded || state.type === StateType.Ready) {
- badge = new NumberBadge(1, () => nls.localize('updateIsReady', "New {0} update available.", product.nameShort));
+ badge = new NumberBadge(1, () => nls.localize('updateIsReady', "New {0} update available.", this.productService.nameShort));
2019-08-08 05:18:17 +08:00
} else if (state.type === StateType.CheckingForUpdates || state.type === StateType.Downloading || state.type === StateType.Updating) {
- badge = new ProgressBadge(() => nls.localize('updateIsReady', "New {0} update available.", product.nameShort));
+ badge = new ProgressBadge(() => nls.localize('updateIsReady', "New {0} update available.", this.productService.nameShort));
2019-08-08 05:18:17 +08:00
clazz = 'progress-badge';
}
@@ -316,14 +304,14 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-08 05:18:17 +08:00
}, {
label: nls.localize('later', "Later"),
run: () => { }
- }, {
+ }/*, {
label: nls.localize('releaseNotes', "Release Notes"),
run: () => {
const action = this.instantiationService.createInstance(ShowReleaseNotesAction, update.productVersion);
action.run();
action.dispose();
}
- }],
+ }*/],
{ sticky: true }
);
}
@@ -336,35 +324,32 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-08 05:18:17 +08:00
this.notificationService.prompt(
severity.Info,
- nls.localize('updateAvailable', "There's an update available: {0} {1}", product.nameLong, update.productVersion),
+ nls.localize('updateAvailable', "There's an update available: {0} {1}", this.productService.nameLong, update.productVersion),
[{
label: nls.localize('installUpdate', "Install Update"),
run: () => this.updateService.applyUpdate()
}, {
label: nls.localize('later', "Later"),
run: () => { }
- }, {
+ }/*, {
label: nls.localize('releaseNotes', "Release Notes"),
run: () => {
const action = this.instantiationService.createInstance(ShowReleaseNotesAction, update.productVersion);
action.run();
action.dispose();
}
- }],
+ }*/],
{ sticky: true }
);
}
// windows fast updates
private onUpdateUpdating(update: IUpdate): void {
- if (isWindows && product.target === 'user') {
- return;
- }
// windows fast updates (target === system)
this.notificationService.prompt(
2019-08-08 05:18:17 +08:00
severity.Info,
- nls.localize('updateInstalling', "{0} {1} is being installed in the background; we'll let you know when it's done.", product.nameLong, update.productVersion),
+ nls.localize('updateInstalling', "{0} {1} is being installed in the background; we'll let you know when it's done.", this.productService.nameLong, update.productVersion),
[],
{
neverShowAgain: { id: 'neverShowAgain:update/win32-fast-updates', isSecondary: true }
@@ -374,20 +359,17 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-08 05:18:17 +08:00
// windows and mac
private onUpdateReady(update: IUpdate): void {
- if (!(isWindows && product.target !== 'user') && !this.shouldShowNotification()) {
- return;
- }
const actions = [{
label: nls.localize('updateNow', "Update Now"),
- run: () => this.updateService.quitAndInstall()
2019-08-10 07:50:05 +08:00
+ run: () => { this.updateService.quitAndInstall(); window.location.reload(); }
2019-08-08 05:18:17 +08:00
}, {
label: nls.localize('later', "Later"),
run: () => { }
}];
// TODO@joao check why snap updates send `update` as falsy
- if (update.productVersion) {
+ /*if (update.productVersion) {
actions.push({
label: nls.localize('releaseNotes', "Release Notes"),
run: () => {
@@ -396,19 +378,19 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-08 05:18:17 +08:00
action.dispose();
}
});
- }
+ }*/
// windows user fast updates and mac
this.notificationService.prompt(
severity.Info,
- nls.localize('updateAvailableAfterRestart', "Restart {0} to apply the latest update.", product.nameLong),
+ nls.localize('updateAvailableAfterRestart', "Restart {0} to apply the latest update.", this.productService.nameLong),
actions,
{ sticky: true }
);
}
private shouldShowNotification(): boolean {
- const currentVersion = product.commit;
+ const currentVersion = this.productService.commit;
const currentMillis = new Date().getTime();
const lastKnownVersion = this.storageService.get('update/lastKnownVersion', StorageScope.GLOBAL);
@@ -451,7 +433,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-08 05:18:17 +08:00
group: '5_update',
command: {
id: 'update.downloadNow',
- title: nls.localize('download update', "Download Update")
+ title: nls.localize('installUpdate', "Install Update")
2019-08-08 05:18:17 +08:00
},
when: CONTEXT_UPDATE_STATE.isEqualTo(StateType.AvailableForDownload)
});
@@ -488,7 +470,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-08 05:18:17 +08:00
when: CONTEXT_UPDATE_STATE.isEqualTo(StateType.Updating)
});
- CommandsRegistry.registerCommand('update.restart', () => this.updateService.quitAndInstall());
2019-08-10 07:50:05 +08:00
+ CommandsRegistry.registerCommand('update.restart', () => { this.updateService.quitAndInstall(); window.location.reload(); });
2019-08-08 05:18:17 +08:00
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
group: '5_update',
command: {
diff --git a/src/vs/workbench/contrib/webview/browser/pre/main.js b/src/vs/workbench/contrib/webview/browser/pre/main.js
index c97da43b4c..6a66b9435f 100644
--- a/src/vs/workbench/contrib/webview/browser/pre/main.js
+++ b/src/vs/workbench/contrib/webview/browser/pre/main.js
@@ -411,7 +411,7 @@
2019-08-10 07:50:05 +08:00
newFrame.contentWindow.addEventListener('keydown', handleInnerKeydown);
- newFrame.contentWindow.addEventListener('DOMContentLoaded', e => {
+ newFrame.contentWindow.addEventListener('load', e => {
if (host.fakeLoad) {
newFrame.contentDocument.open();
newFrame.contentDocument.write(newDocument);
diff --git a/src/vs/workbench/contrib/webview/browser/webviewElement.ts b/src/vs/workbench/contrib/webview/browser/webviewElement.ts
index a7b1d1bd42..61fe0f205e 100644
--- a/src/vs/workbench/contrib/webview/browser/webviewElement.ts
+++ b/src/vs/workbench/contrib/webview/browser/webviewElement.ts
@@ -184,7 +184,7 @@ export class IFrameWebview extends Disposable implements Webview {
private preprocessHtml(value: string): string {
return value.replace(/(["'])vscode-resource:([^\s'"]+?)(["'])/gi, (_, startQuote, path, endQuote) =>
- `${startQuote}${this.endpoint}/vscode-resource${path}${endQuote}`);
+ `${startQuote}${this.endpoint}/vscode-resource${path}${endQuote}`).replace(/vscode-resource:/g, `'self'`);
}
public update(html: string, options: WebviewContentOptions, retainContextWhenHidden: boolean) {
diff --git a/src/vs/workbench/contrib/welcome/walkThrough/browser/editor/editorWalkThrough.ts b/src/vs/workbench/contrib/welcome/walkThrough/browser/editor/editorWalkThrough.ts
index 8493b87f2c..b5c47ea23f 100644
--- a/src/vs/workbench/contrib/welcome/walkThrough/browser/editor/editorWalkThrough.ts
+++ b/src/vs/workbench/contrib/welcome/walkThrough/browser/editor/editorWalkThrough.ts
@@ -16,7 +16,8 @@ const typeId = 'workbench.editors.walkThroughInput';
const inputOptions: WalkThroughInputOptions = {
typeId,
name: localize('editorWalkThrough.title', "Interactive Playground"),
- resource: URI.parse(require.toUrl('./vs_code_editor_walkthrough.md'))
+ resource: URI.parse(require.toUrl('./vs_code_editor_walkthrough.md')
+ .replace(`${window.location.origin}${window.location.pathname.replace(/\/+$/, '')}`, window.location.origin))
.with({ scheme: Schemas.walkThrough }),
telemetryFrom: 'walkThrough'
};
diff --git a/src/vs/workbench/services/environment/browser/environmentService.ts b/src/vs/workbench/services/environment/browser/environmentService.ts
2019-09-13 01:49:28 +08:00
index 7c3b6ae53e..18dec6effa 100644
--- a/src/vs/workbench/services/environment/browser/environmentService.ts
+++ b/src/vs/workbench/services/environment/browser/environmentService.ts
2019-09-13 01:49:28 +08:00
@@ -177,6 +177,8 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
driverHandle?: string;
driverVerbose: boolean;
2019-08-10 07:50:05 +08:00
galleryMachineIdResource?: URI;
+ extraExtensionPaths: string[];
+ extraBuiltinExtensionPaths: string[];
readonly logFile: URI;
get webviewResourceRoot(): string {
diff --git a/src/vs/workbench/services/extensions/browser/extensionService.ts b/src/vs/workbench/services/extensions/browser/extensionService.ts
index 0f09ebb5b6..1efd5fb196 100644
--- 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
index a1496708db..e65acfffbe 100644
--- a/src/vs/workbench/services/extensions/common/extensionsUtil.ts
+++ b/src/vs/workbench/services/extensions/common/extensionsUtil.ts
@@ -12,7 +12,7 @@ import { IProductService } from 'vs/platform/product/common/product';
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 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
index 6d31b177ac..67c955a59d 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
@@ -41,12 +41,12 @@ const args = minimist(process.argv.slice(2), {
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);
+ return originalLoad.apply(this, [request.replace(/node_modules\.asar(\.unpacked)?/, 'node_modules'), parent, isMain]);
};
})();
@@ -128,7 +128,7 @@ function _createExtHostProtocol(): Promise<IMessagePassingProtocol> {
} else {
// Do not wait for web companion to reconnect
2019-09-10 07:44:17 +08:00
protocol.onSocketClose(() => {
- onTerminate();
+ process.send!({ type: 'VSCODE_EXTHOST_DISCONNECTED' });
});
}
2019-09-10 07:44:17 +08:00
}
diff --git a/src/vs/workbench/services/extensions/worker/extHost.services.ts b/src/vs/workbench/services/extensions/worker/extHost.services.ts
index bf4a779155..1aa90b3e36 100644
--- 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-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
index 681fc606b6..e34ef5d4bc 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
@@ -34,7 +34,7 @@ import 'vs/workbench/services/textfile/browser/textFileService';
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';
+// import 'vs/workbench/services/telemetry/browser/telemetryService';
2019-08-10 07:50:05 +08:00
import 'vs/workbench/services/configurationResolver/browser/configurationResolverService';
import 'vs/workbench/services/credentials/browser/credentialsService';
import 'vs/workbench/services/url/browser/urlService';