Archived
1
0
This repository has been archived on 2024-09-09. You can view files and clone it, but cannot push or open issues or pull requests.
code-server/scripts/vscode.patch

1193 lines
58 KiB
Diff
Raw Normal View History

diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js
2019-08-10 01:50:05 +02:00
index 99bd930a91..319c4bd3c3 100644
--- a/build/gulpfile.vscode.js
+++ b/build/gulpfile.vscode.js
2019-08-10 01:50:05 +02:00
@@ -47,24 +47,31 @@ const nodeModules = ['electron', 'original-fs']
// Build
const vscodeEntryPoints = _.flatten([
- buildfile.entrypoint('vs/workbench/workbench.main'),
2019-08-10 01:50:05 +02:00
+ // buildfile.entrypoint('vs/workbench/workbench.main'),
+ buildfile.entrypoint('vs/workbench/workbench.web.api'),
+ buildfile.entrypoint('vs/server/src/cli'),
+ buildfile.entrypoint('vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.linux'),
+ buildfile.entrypoint('vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.win'),
+ buildfile.entrypoint('vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.darwin'),
buildfile.base,
2019-08-10 01:50:05 +02:00
buildfile.serviceWorker,
- buildfile.workbench,
- buildfile.code
+ buildfile.workbenchWeb,
+ // buildfile.code
]);
const vscodeResources = [
- 'out-build/main.js',
- 'out-build/cli.js',
- 'out-build/driver.js',
2019-08-10 01:50:05 +02:00
+ // 'out-build/main.js',
+ // 'out-build/cli.js',
+ // 'out-build/driver.js',
2019-08-10 01:50:05 +02:00
+ 'out-build/vs/server/main.js',
+ 'out-build/vs/server/src/uriTransformer.js',
'out-build/bootstrap.js',
'out-build/bootstrap-fork.js',
'out-build/bootstrap-amd.js',
'out-build/bootstrap-window.js',
'out-build/paths.js',
2019-08-10 01:50:05 +02:00
- 'out-build/vs/**/*.{svg,png,html}',
- '!out-build/vs/code/browser/**/*.html',
2019-08-10 01:50:05 +02:00
+ 'out-build/vs/**/*.{svg,png,html,ico}',
+ // '!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}',
2019-08-10 01:50:05 +02:00
@@ -79,10 +86,12 @@ const vscodeResources = [
'out-build/vs/workbench/contrib/welcome/walkThrough/**/*.md',
2019-08-10 01:50:05 +02: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',
+ 'out-build/vs/code/browser/workbench/**',
2019-08-10 01:50:05 +02:00
+ // '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',
+ '!out-build/vs/server/doc/**',
'!**/test/**'
];
2019-08-10 01:50:05 +02:00
diff --git a/src/vs/base/browser/dom.ts b/src/vs/base/browser/dom.ts
2019-08-16 21:15:55 +02:00
index fa12f62900..509e76ecb7 100644
2019-08-10 01:50:05 +02:00
--- a/src/vs/base/browser/dom.ts
+++ b/src/vs/base/browser/dom.ts
@@ -1187,6 +1187,7 @@ export function animate(fn: () => void): IDisposable {
+const basePath = window.location.pathname.replace(/\/+$/, '');
const _location = URI.parse(window.location.href);
export function asDomUri(uri: URI): URI {
2019-08-16 21:15:55 +02:00
@@ -1200,7 +1201,7 @@ export function asDomUri(uri: URI): URI {
if (Schemas.vscodeRemote === uri.scheme) {
2019-08-10 01:50:05 +02:00
// rewrite vscode-remote-uris to uris of the window location
// so that they can be intercepted by the service worker
- return _location.with({ path: '/vscode-resources/fetch', query: `u=${JSON.stringify(uri)}` });
+ return _location.with({ path: `${basePath}/vscode-resources/fetch`, query: `u=${JSON.stringify(uri)}` });
2019-08-10 01:50:05 +02:00
}
return uri;
2019-07-22 23:00:59 +02:00
}
2019-08-22 18:33:58 +02:00
diff --git a/src/vs/base/browser/mouseEvent.ts b/src/vs/base/browser/mouseEvent.ts
index 4c7295e3b9..b0af2cdd62 100644
--- a/src/vs/base/browser/mouseEvent.ts
+++ b/src/vs/base/browser/mouseEvent.ts
@@ -160,6 +160,8 @@ export class StandardWheelEvent {
this.deltaY = e1.wheelDeltaY / 120;
} else if (typeof e2.VERTICAL_AXIS !== 'undefined' && e2.axis === e2.VERTICAL_AXIS) {
this.deltaY = -e2.detail / 3;
+ } else if (browser.isFirefox) {
+ this.deltaY = -e.deltaY / 3;
} else {
this.deltaY = -e.deltaY / 40;
}
@@ -173,6 +175,8 @@ export class StandardWheelEvent {
}
} else if (typeof e2.HORIZONTAL_AXIS !== 'undefined' && e2.axis === e2.HORIZONTAL_AXIS) {
this.deltaX = -e.detail / 3;
+ } else if (browser.isFirefox) {
+ this.deltaX = -e.deltaX / 3;
} else {
this.deltaX = -e.deltaX / 40;
}
2019-07-27 00:24:27 +02:00
diff --git a/src/vs/base/browser/ui/menu/menu.ts b/src/vs/base/browser/ui/menu/menu.ts
2019-08-10 01:50:05 +02:00
index c2b60a5dc9..3f40fa0bdf 100644
2019-07-27 00:24:27 +02:00
--- a/src/vs/base/browser/ui/menu/menu.ts
+++ b/src/vs/base/browser/ui/menu/menu.ts
@@ -22,7 +22,7 @@ import { isLinux, isMacintosh } from 'vs/base/common/platform';
function createMenuMnemonicRegExp() {
try {
- return new RegExp('\\(&([^\\s&])\\)|(?<!&)&([^\\s&])');
+ return new RegExp('\\(&([^\\s&])\\)|([^&]|^)&([^\\s&])');
} catch (err) {
return new RegExp('\uFFFF'); // never match please
}
2019-08-10 01:50:05 +02:00
@@ -802,7 +802,7 @@ export function cleanMnemonic(label: string): string {
2019-07-27 00:24:27 +02:00
return label;
}
- const mnemonicInText = matches[0].charAt(0) === '&';
2019-08-10 01:50:05 +02:00
+ const mnemonicInText = matches[3];
2019-07-27 00:24:27 +02:00
- return label.replace(regex, mnemonicInText ? '$2' : '').trim();
+ return label.replace(regex, mnemonicInText ? '$2$3' : '').trim();
2019-07-19 22:10:43 +02:00
}
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-08-16 21:15:55 +02:00
index 46d2933a05..42a3d77802 100644
2019-07-22 23:00:59 +02:00
--- a/src/vs/base/common/network.ts
+++ b/src/vs/base/common/network.ts
2019-08-16 21:15:55 +02:00
@@ -45,7 +45,7 @@ export namespace Schemas {
2019-07-22 23:00:59 +02:00
export const command: string = 'command';
2019-08-16 21:15:55 +02:00
- export const vscodeRemote: string = 'vscode-remote';
+ export const vscodeRemote: string = 'code-server';
2019-08-10 01:50:05 +02:00
export const userData: string = 'vscode-userdata';
2019-07-22 23:00:59 +02:00
}
diff --git a/src/vs/base/common/platform.ts b/src/vs/base/common/platform.ts
2019-08-10 01:50:05 +02:00
index d7371552d3..d2ab92983e 100644
--- a/src/vs/base/common/platform.ts
+++ b/src/vs/base/common/platform.ts
2019-08-10 01:50:05 +02: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');
2019-07-22 23:00:59 +02:00
diff --git a/src/vs/code/browser/workbench/workbench.html b/src/vs/code/browser/workbench/workbench.html
2019-08-10 01:50:05 +02:00
index 5b06636edb..60b508079a 100644
2019-07-22 23:00:59 +02:00
--- a/src/vs/code/browser/workbench/workbench.html
+++ b/src/vs/code/browser/workbench/workbench.html
2019-08-10 01:50:05 +02:00
@@ -4,7 +4,7 @@
2019-07-22 23:00:59 +02:00
<head>
<meta charset="utf-8" />
2019-08-10 01:50:05 +02:00
- <link rel="icon" href="/favicon.ico" type="image/x-icon" />
+ <link rel="icon" href="./favicon.ico" type="image/x-icon" />
2019-07-22 23:00:59 +02:00
2019-08-10 01:50:05 +02:00
<!-- Disable pinch zooming -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
@@ -19,13 +19,14 @@
2019-08-10 01:50:05 +02:00
<!-- Workaround to pass product configuration-->
<meta id="vscode-remote-product-configuration" data-settings="{{PRODUCT_CONFIGURATION}}">
+ <meta id="vscode-remote-nls-configuration" data-settings="{{NLS_CONFIGURATION}}">
</head>
2019-08-10 01:50:05 +02:00
<body aria-label="">
</body>
<!-- Application insights telemetry library -->
- <script src="https://az416426.vo.msecnd.net/scripts/a/ai.0.js"></script>
+ <!-- <script src="https://az416426.vo.msecnd.net/scripts/a/ai.0.js"></script> -->
<!-- Require our AMD loader -->
<script src="./out/vs/loader.js"></script>
2019-07-22 23:00:59 +02:00
diff --git a/src/vs/code/browser/workbench/workbench.js b/src/vs/code/browser/workbench/workbench.js
2019-08-14 17:25:31 +02:00
index 65fae7c82d..a1974cd941 100644
2019-07-22 23:00:59 +02:00
--- a/src/vs/code/browser/workbench/workbench.js
+++ b/src/vs/code/browser/workbench/workbench.js
2019-08-14 17:25:31 +02:00
@@ -7,21 +7,52 @@
2019-07-22 23:00:59 +02:00
(function () {
+ const basePath = window.location.pathname.replace(/\/+$/, '');
+ const base = window.location.origin + basePath;
2019-08-14 17:25:31 +02: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}/resources/fetch?u=${JSON.stringify({ path })}`)
+ .then((response) => response.json())
+ .then((json) => {
+ bundles[bundle] = json;
+ cb(undefined, json);
+ })
+ .catch(cb);
+ };
+ }
+ } catch (error) { /* Probably fine. */ }
+
2019-07-22 23:00:59 +02:00
require.config({
- baseUrl: `${window.location.origin}/out`,
+ baseUrl: `${base}/out`,
+ baseScheme: window.location.protocol.replace(/:$/, ''),
2019-07-23 21:55:48 +02:00
+ basePath: basePath,
2019-07-22 23:00:59 +02:00
+ baseAuthority: window.location.host,
paths: {
- 'vscode-textmate': `${window.location.origin}/node_modules/vscode-textmate/release/main`,
- 'onigasm-umd': `${window.location.origin}/node_modules/onigasm-umd/release/main`,
- 'xterm': `${window.location.origin}/node_modules/xterm/lib/xterm.js`,
- 'xterm-addon-search': `${window.location.origin}/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
- 'xterm-addon-web-links': `${window.location.origin}/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`,
2019-08-10 01:50:05 +02:00
- 'semver-umd': `${window.location.origin}/node_modules/semver-umd/lib/semver-umd.js`,
2019-08-14 17:25:31 +02:00
- }
2019-07-22 23:00:59 +02:00
+ 'vscode-textmate': `${base}/node_modules/vscode-textmate/release/main`,
+ 'onigasm-umd': `${base}/node_modules/onigasm-umd/release/main`,
+ 'xterm': `${base}/node_modules/xterm/lib/xterm.js`,
+ 'xterm-addon-search': `${base}/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
+ 'xterm-addon-web-links': `${base}/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`,
2019-08-10 01:50:05 +02:00
+ 'semver-umd': `${base}/node_modules/semver-umd/lib/semver-umd.js`,
2019-08-14 17:25:31 +02:00
+ },
+ 'vs/nls': nlsConfig
2019-07-22 23:00:59 +02:00
});
2019-08-12 17:23:08 +02:00
require(['vs/workbench/workbench.web.api'], function (api) {
const options = JSON.parse(document.getElementById('vscode-workbench-web-configuration').getAttribute('data-settings'));
-
+ options.webviewEndpoint = `${base}/webview/`;
api.create(document.body, options);
});
})();
\ No newline at end of file
diff --git a/src/vs/platform/environment/common/environment.ts b/src/vs/platform/environment/common/environment.ts
2019-08-10 01:50:05 +02:00
index a6c9eb9d11..3f8995b727 100644
--- a/src/vs/platform/environment/common/environment.ts
+++ b/src/vs/platform/environment/common/environment.ts
2019-08-10 01:50:05 +02:00
@@ -81,6 +81,8 @@ export interface ParsedArgs {
2019-08-10 01:50:05 +02: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');
@@ -173,4 +175,6 @@ export interface IEnvironmentService {
readonly webviewCspSource: string;
readonly galleryMachineIdResource?: URI;
+ extraExtensionPaths: string[];
+ extraBuiltinExtensionPaths: string[];
}
diff --git a/src/vs/platform/environment/node/environmentService.ts b/src/vs/platform/environment/node/environmentService.ts
index 9373b22383..a98ff4723c 100644
--- a/src/vs/platform/environment/node/environmentService.ts
+++ b/src/vs/platform/environment/node/environmentService.ts
2019-08-10 01:50:05 +02:00
@@ -277,6 +277,15 @@ export class EnvironmentService implements IEnvironmentService {
2019-08-10 01:50:05 +02:00
readonly webviewResourceRoot = 'vscode-resource:{{resource}}';
readonly webviewCspSource = 'vscode-resource:';
+ @memoize get extraExtensionPaths(): string[] {
+ return this.arrayify(this._args['extra-extensions-dir']).map((p) => <string>parsePathArg(p, process));
+ }
2019-08-10 01:50:05 +02:00
+ @memoize get extraBuiltinExtensionPaths(): string[] {
+ return this.arrayify(this._args['extra-builtin-extensions-dir']).map((p) => <string>parsePathArg(p, process));
+ }
2019-08-10 01:50:05 +02:00
+ private arrayify<T>(arg: T | T[] = []): T[] {
+ return (Array.isArray(arg) ? arg : [arg]).filter((p) => !!p);
2019-08-10 01:50:05 +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
index 70cd46c824..3a38a91d8b 100644
--- a/src/vs/platform/extensionManagement/node/extensionManagementService.ts
+++ b/src/vs/platform/extensionManagement/node/extensionManagementService.ts
2019-08-10 01:50:05 +02:00
@@ -725,11 +725,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;
}
2019-08-10 01:50:05 +02:00
@@ -751,9 +755,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) {
@@ -768,6 +779,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));
}
@@ -806,7 +823,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()]) {
@@ -825,7 +842,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-08-10 01:50:05 +02:00
index 353161166e..cff8e2750e 100644
--- a/src/vs/platform/localizations/electron-browser/localizationsService.ts
+++ b/src/vs/platform/localizations/electron-browser/localizationsService.ts
2019-08-10 01:50:05 +02: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-08-10 01:50:05 +02:00
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
export class LocalizationsService implements ILocalizationsService {
2019-08-10 01:50:05 +02: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 01:50:05 +02:00
+ constructor(@IRemoteAgentService remoteAgentService: IRemoteAgentService) {
+ this.channel = remoteAgentService.getConnection()!.getChannel('localizations');
}
get onDidLanguagesChange(): Event<void> { return this.channel.listen('onDidLanguagesChange'); }
2019-07-16 21:57:02 +02:00
diff --git a/src/vs/platform/log/common/logIpc.ts b/src/vs/platform/log/common/logIpc.ts
2019-08-10 01:50:05 +02:00
index 9f68b645b6..54f9e26c88 100644
2019-07-16 21:57:02 +02: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}`);
2019-08-10 01:50:05 +02:00
@@ -43,6 +44,9 @@ export class LogLevelSetterChannelClient {
setLevel(level: LogLevel): void {
this.channel.call('setLevel', level);
2019-07-16 21:57:02 +02:00
}
+ getLevel(): Promise<LogLevel> {
+ return this.channel.call('getLevel');
+ }
2019-08-10 01:50:05 +02:00
}
export class FollowerLogService extends DelegatedLogService implements ILogService {
2019-08-07 23:18:17 +02:00
diff --git a/src/vs/platform/product/browser/productService.ts b/src/vs/platform/product/browser/productService.ts
2019-08-10 01:50:05 +02:00
index fbdf03fd3e..d498d4d192 100644
2019-08-07 23:18:17 +02:00
--- a/src/vs/platform/product/browser/productService.ts
+++ b/src/vs/platform/product/browser/productService.ts
@@ -17,7 +17,7 @@ export class ProductService implements IProductService {
_serviceBrand: ServiceIdentifier<IProductService>;
- get version(): string { return '1.35.0'; }
+ get version(): string { return this.productConfiguration ? (this.productConfiguration as any).version : 'development'; }
2019-08-10 01:50:05 +02:00
get commit(): string | undefined { return this.productConfiguration ? this.productConfiguration.commit : undefined; }
2019-08-07 23:18:17 +02: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 01:50:05 +02:00
diff --git a/src/vs/platform/remote/browser/browserSocketFactory.ts b/src/vs/platform/remote/browser/browserSocketFactory.ts
index 6b24ec0781..4d05c63193 100644
--- 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-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`);
+ 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-08-07 23:18:17 +02:00
diff --git a/src/vs/platform/update/electron-browser/updateService.ts b/src/vs/platform/update/electron-browser/updateService.ts
2019-08-10 01:50:05 +02:00
index 952c39cdbe..fee00b3b39 100644
2019-08-07 23:18:17 +02:00
--- a/src/vs/platform/update/electron-browser/updateService.ts
+++ b/src/vs/platform/update/electron-browser/updateService.ts
2019-08-10 01:50:05 +02:00
@@ -6,7 +6,7 @@
2019-08-07 23:18:17 +02: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-08-10 01:50:05 +02:00
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
2019-08-07 23:18:17 +02:00
export class UpdateService implements IUpdateService {
2019-08-10 01:50:05 +02:00
@@ -21,8 +21,8 @@ export class UpdateService implements IUpdateService {
2019-08-07 23:18:17 +02:00
private channel: IChannel;
- constructor(@IMainProcessService mainProcessService: IMainProcessService) {
- this.channel = mainProcessService.getChannel('update');
2019-08-10 01:50:05 +02:00
+ constructor(@IRemoteAgentService mainProcessService: IRemoteAgentService) {
+ this.channel = mainProcessService.getConnection()!.getChannel('update');
2019-08-07 23:18:17 +02: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-08-10 01:50:05 +02:00
index 2a1240b1eb..342e9aa51d 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';
-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 01:50:05 +02:00
@@ -44,7 +43,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
2019-08-07 23:18:17 +02: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 01:50:05 +02:00
@@ -55,7 +54,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
2019-08-07 23:18:17 +02:00
return;
}
- if (!product.updateUrl || !product.commit) {
2019-08-10 01:50:05 +02:00
+ if (!product.commit) {
2019-08-07 23:18:17 +02:00
this.logService.info('update#ctor - updates are disabled as there is no update URL');
return;
}
2019-08-10 01:50:05 +02:00
@@ -86,7 +85,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
2019-08-07 23:18:17 +02:00
}
private getProductQuality(updateMode: string): string | undefined {
- return updateMode === 'none' ? undefined : product.quality;
2019-08-10 01:50:05 +02:00
+ return updateMode === 'none' ? undefined : 'unused';
2019-08-07 23:18:17 +02:00
}
private scheduleCheckForUpdates(delay = 60 * 60 * 1000): Promise<void> {
2019-08-10 01:50:05 +02:00
@@ -145,15 +144,15 @@ export abstract class AbstractUpdateService implements IUpdateService {
2019-08-07 23:18:17 +02: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 01:50:05 +02:00
+ // this.lifecycleService.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;
+ // }
this.logService.trace('update#quitAndInstall(): running raw#quitAndInstall()');
this.doQuitAndInstall();
- });
+ // });
return Promise.resolve(undefined);
}
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-08-10 01:50:05 +02:00
index cf1d6b5b60..be8fdb32f7 100644
2019-07-19 22:10:43 +02:00
--- a/src/vs/workbench/browser/dnd.ts
+++ b/src/vs/workbench/browser/dnd.ts
2019-08-10 01:50:05 +02:00
@@ -32,6 +32,7 @@ import { IRecentFile } from 'vs/platform/history/common/history';
2019-07-19 22:10:43 +02:00
import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing';
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-07-19 22:10:43 +02:00
+import { IUploadService } from 'vs/server/src/upload';
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-23 21:54:39 +02:00
diff --git a/src/vs/workbench/browser/layout.ts b/src/vs/workbench/browser/layout.ts
index a213ed7b02..df1ce972c6 100644
--- a/src/vs/workbench/browser/layout.ts
+++ b/src/vs/workbench/browser/layout.ts
@@ -230,7 +230,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
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();
this.layout();
}
@@ -519,13 +519,13 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
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-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-08-16 21:15:55 +02:00
index ede771a03e..2621eb3755 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-08-10 01:50:05 +02:00
@@ -43,6 +43,7 @@ import { getThemeTypeSelector, DARK, HIGH_CONTRAST, LIGHT } from 'vs/platform/th
import { IRequestService } from 'vs/platform/request/common/request';
import { RequestService } from 'vs/workbench/services/request/browser/requestService';
import { InMemoryUserDataProvider } from 'vs/workbench/services/userData/common/inMemoryUserDataProvider';
+import { initialize } from 'vs/server/src/client';
2019-07-17 18:57:26 +02:00
class CodeRendererMain extends Disposable {
2019-08-10 01:50:05 +02:00
@@ -57,6 +58,7 @@ class CodeRendererMain extends Disposable {
2019-07-17 18:57:26 +02:00
async open(): Promise<void> {
const services = await this.initServices();
+ await initialize(services.serviceCollection);
2019-07-17 18:57:26 +02:00
await domContentLoaded();
mark('willStartWorkbench');
2019-08-16 21:15:55 +02:00
@@ -150,6 +152,7 @@ class CodeRendererMain extends Disposable {
2019-07-10 23:29:15 +02:00
const remoteFileSystemProvider = this._register(new RemoteExtensionsFileSystemProvider(channel, remoteAgentService.getEnvironment()));
2019-07-13 02:09:07 +02:00
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-10 01:50:05 +02:00
if (!userDataProvider) {
const remoteUserDataUri = this.getRemoteUserDataUri();
2019-07-10 23:29:15 +02:00
diff --git a/src/vs/workbench/browser/web.simpleservices.ts b/src/vs/workbench/browser/web.simpleservices.ts
index 25414d8733..20b0ad4a49 100644
2019-07-10 23:29:15 +02:00
--- a/src/vs/workbench/browser/web.simpleservices.ts
+++ b/src/vs/workbench/browser/web.simpleservices.ts
@@ -38,6 +38,10 @@ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteA
2019-08-10 01:50:05 +02:00
import { IExperimentService, IExperiment, ExperimentActionType, ExperimentState } from 'vs/workbench/contrib/experiments/common/experimentService';
import { ExtensionHostDebugChannelClient, ExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/common/extensionHostDebugIpc';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
+import { ExtensionManagementChannelClient } from 'vs/platform/extensionManagement/common/extensionManagementIpc';
+import { withQuery } from 'vs/server/src/client';
2019-07-19 22:10:43 +02:00
+import { IUploadService, UploadService } from 'vs/server/src/upload';
+registerSingleton(IUploadService, UploadService, true);
2019-07-13 02:09:07 +02:00
2019-08-10 01:50:05 +02:00
//#region Extension Tips
2019-07-13 02:09:07 +02:00
@@ -131,7 +135,15 @@ export class SimpleExtensionManagementService implements IExtensionManagementSer
2019-07-10 23:29:15 +02:00
}
}
2019-07-13 02:09:07 +02:00
2019-07-10 23:29:15 +02:00
-registerSingleton(IExtensionManagementService, SimpleExtensionManagementService);
+// registerSingleton(IExtensionManagementService, SimpleExtensionManagementService);
+class LocalExtensionManagementService extends ExtensionManagementChannelClient {
+ public constructor(
+ @IRemoteAgentService remoteAgentService: IRemoteAgentService,
+ ) {
+ super(remoteAgentService.getConnection()!.getChannel('extensions'));
+ }
+}
+registerSingleton(IExtensionManagementService, LocalExtensionManagementService);
2019-07-13 02:09:07 +02:00
2019-07-10 23:29:15 +02:00
//#endregion
2019-07-13 02:09:07 +02:00
@@ -251,7 +263,7 @@ export class SimpleUpdateService implements IUpdateService {
2019-08-07 23:18:17 +02:00
}
}
-registerSingleton(IUpdateService, SimpleUpdateService);
+// registerSingleton(IUpdateService, SimpleUpdateService);
//#endregion
@@ -491,7 +503,11 @@ export class SimpleWindowService extends Disposable implements IWindowService {
2019-07-23 21:55:48 +02:00
for (let i = 0; i < _uris.length; i++) {
const uri = _uris[i];
if ('folderUri' in uri) {
2019-08-10 01:50:05 +02:00
- const newAddress = `${document.location.origin}/?folder=${uri.folderUri.path}${this.workbenchEnvironmentService.configuration.connectionToken ? `&tkn=${this.workbenchEnvironmentService.configuration.connectionToken}` : ''}`;
+ const newAddress = withQuery(window.location.toString(), {
+ folder: uri.folderUri.path,
+ tkn: this.workbenchEnvironmentService.configuration.connectionToken,
+ workspace: undefined,
+ });
2019-07-23 21:55:48 +02:00
if (openFolderInNewWindow) {
window.open(newAddress);
} else {
@@ -499,7 +515,10 @@ export class SimpleWindowService extends Disposable implements IWindowService {
2019-07-23 21:55:48 +02: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-23 21:55:48 +02:00
if (openFolderInNewWindow) {
window.open(newAddress);
} else {
@@ -718,6 +737,7 @@ export class SimpleWindowsService implements IWindowsService {
}
relaunch(_options: { addArgs?: string[], removeArgs?: string[] }): Promise<void> {
+ window.location.reload();
return Promise.resolve();
}
2019-08-10 01:50:05 +02:00
diff --git a/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts b/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts
index d29d891120..6550d32c42 100644
--- a/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts
+++ b/src/vs/workbench/contrib/extensions/browser/extensionEditor.ts
@@ -8,7 +8,7 @@ import { localize } from 'vs/nls';
2019-07-10 23:29:15 +02:00
import * as marked from 'vs/base/common/marked/marked';
2019-08-10 01:50:05 +02:00
import { createCancelablePromise } from 'vs/base/common/async';
import * as arrays from 'vs/base/common/arrays';
-import { OS } from 'vs/base/common/platform';
+import { OS, OperatingSystem } from 'vs/base/common/platform';
import { Event, Emitter } from 'vs/base/common/event';
import { Cache, CacheResult } from 'vs/base/common/cache';
import { Action } from 'vs/base/common/actions';
@@ -60,7 +60,7 @@ function renderBody(body: string): string {
2019-07-10 23:29:15 +02:00
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
- <meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; script-src 'none'; style-src vscode-resource:; child-src 'none'; frame-src 'none';">
2019-08-10 01:50:05 +02:00
+ <meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; script-src 'none'; style-src 'self'; child-src 'none'; frame-src 'none';">
2019-07-10 23:29:15 +02:00
<link rel="stylesheet" type="text/css" href="${styleSheetPath}">
</head>
<body>
2019-08-10 01:50:05 +02:00
@@ -1076,10 +1076,10 @@ export class ExtensionEditor extends BaseEditor {
private resolveKeybinding(rawKeyBinding: IKeyBinding): ResolvedKeybinding | null {
let key: string | undefined;
- switch (process.platform) {
- case 'win32': key = rawKeyBinding.win; break;
- case 'linux': key = rawKeyBinding.linux; break;
- case 'darwin': key = rawKeyBinding.mac; break;
+ switch (OS) {
+ case OperatingSystem.Windows: key = rawKeyBinding.win; break;
+ case OperatingSystem.Linux: key = rawKeyBinding.linux; break;
+ case OperatingSystem.Macintosh: key = rawKeyBinding.mac; break;
2019-07-23 20:27:30 +02:00
}
2019-07-13 02:09:07 +02:00
2019-08-10 01:50:05 +02:00
const keyBinding = KeybindingParser.parseKeybinding(key || rawKeyBinding.key, OS);
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-08-10 01:50:05 +02:00
index b219a608bd..f35f5fa410 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-08-10 01:50:05 +02:00
@@ -224,7 +224,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-08-10 01:50:05 +02:00
index 6543070e81..3d2780f1ba 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
@@ -46,6 +46,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
import { findValidPasteFileTarget } from 'vs/workbench/contrib/files/browser/fileActions';
import { FuzzyScore, createMatches } from 'vs/base/common/filters';
+import { IUploadService } from 'vs/server/src/upload';
export class ExplorerDelegate implements IListVirtualDelegate<ExplorerItem> {
@@ -453,7 +454,8 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
@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 = [];
@@ -615,6 +617,7 @@ export class FileDragAndDrop implements ITreeDragAndDrop<ExplorerItem> {
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-16 21:57:02 +02:00
diff --git a/src/vs/workbench/contrib/remote/common/remote.contribution.ts b/src/vs/workbench/contrib/remote/common/remote.contribution.ts
index 9235c739fb..32d203eb32 100644
--- a/src/vs/workbench/contrib/remote/common/remote.contribution.ts
+++ b/src/vs/workbench/contrib/remote/common/remote.contribution.ts
@@ -55,7 +55,8 @@ class RemoteChannelsContribution extends Disposable implements IWorkbenchContrib
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
index 622bb7889b..66dd4b0bbc 100644
--- a/src/vs/workbench/contrib/resources/browser/resourceServiceWorker.ts
+++ b/src/vs/workbench/contrib/resources/browser/resourceServiceWorker.ts
@@ -36,7 +36,8 @@ self.addEventListener('activate', event => {
//#region --- fetching/caching
const _cacheName = 'vscode-resources';
-const _resourcePrefix = '/vscode-resources/fetch';
+const rootPath = self.location.pathname.replace(/\/out\/vs\/workbench\/contrib\/resources\/browser\/resourceServiceWorkerMain.js$/, '');
+const _resourcePrefix = `${rootPath}/vscode-resources/fetch`;
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
index dfda6a1cfb..2b36d35608 100644
--- a/src/vs/workbench/contrib/resources/browser/resourceServiceWorkerClient.ts
+++ b/src/vs/workbench/contrib/resources/browser/resourceServiceWorkerClient.ts
@@ -24,7 +24,11 @@ const _serviceWorker = new class ServiceWorkerStarter {
private _messageHandler?: (event: ExtendableMessageEvent) => void;
constructor() {
- navigator.serviceWorker.register(ServiceWorkerStarter._url, { scope: '/' }).then(reg => {
+ if (!navigator.serviceWorker) {
+ console.warn('Service workers are not enabled.');
+ return;
+ }
+ navigator.serviceWorker.register(ServiceWorkerStarter._url, { scope: window.location.pathname.replace(/\/+$/, '') }).then(reg => {
// console.debug('SW#reg', reg);
return reg.update();
// }).then(() => {
@@ -108,6 +112,7 @@ class ResourceServiceWorker {
if (!el.sheet) {
continue;
}
+ try {
const rules = (<CSSStyleSheet>el.sheet).rules;
for (let j = 0; j < rules.length; j++) {
const rule = rules[j];
@@ -118,6 +123,7 @@ class ResourceServiceWorker {
updateCount += 1;
}
}
+ } catch (error) {/* Firefox errors if trying to modify style elements inserted by extensions. */}
}
// find any tag using remote uris
2019-08-07 23:18:17 +02: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
2019-08-10 01:50:05 +02:00
index e39fa57979..3c775c9a06 100644
2019-08-07 23:18:17 +02: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 01:50:05 +02:00
@@ -4,26 +4,11 @@
2019-08-07 23:18:17 +02: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';
2019-08-10 01:50:05 +02:00
+import { UpdateContribution } from './update';
2019-08-07 23:18:17 +02:00
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
const workbench = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
-workbench.registerWorkbenchContribution(ProductContribution, LifecyclePhase.Restored);
2019-08-10 01:50:05 +02:00
-
-if (platform.isWindows) {
- if (process.arch === 'ia32') {
- workbench.registerWorkbenchContribution(Win3264BitContribution, LifecyclePhase.Restored);
- }
2019-08-07 23:18:17 +02:00
-}
2019-08-10 01:50:05 +02:00
-
2019-08-07 23:18:17 +02:00
workbench.registerWorkbenchContribution(UpdateContribution, LifecyclePhase.Restored);
2019-08-10 01:50:05 +02:00
-
-// Editor
2019-08-07 23:18:17 +02: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
2019-08-10 01:50:05 +02:00
index 0d2d53003b..03489411bb 100644
2019-08-07 23:18:17 +02:00
--- a/src/vs/workbench/contrib/update/electron-browser/update.ts
+++ b/src/vs/workbench/contrib/update/electron-browser/update.ts
2019-08-10 01:50:05 +02:00
@@ -7,34 +7,24 @@ import * as nls from 'vs/nls';
2019-08-07 23:18:17 +02:00
import severity from 'vs/base/common/severity';
import { Action } from 'vs/base/common/actions';
2019-08-10 01:50:05 +02:00
import { Disposable, MutableDisposable } from 'vs/base/common/lifecycle';
2019-08-07 23:18:17 +02: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 { 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 01:50:05 +02:00
-import * as semver from 'semver-umd';
2019-08-07 23:18:17 +02:00
-import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { INotificationService, INotificationHandle, Severity } from 'vs/platform/notification/common/notification';
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 01:50:05 +02:00
-import { ShowCurrentReleaseNotesActionId } from 'vs/workbench/contrib/update/common/update';
-import { IWindowService, IWindowsService } from 'vs/platform/windows/common/windows';
2019-08-07 23:18:17 +02: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) {
2019-08-10 01:50:05 +02:00
@@ -160,7 +150,7 @@ export class ProductContribution implements IWorkbenchContribution {
storageService.store(ProductContribution.KEY, pkg.version, StorageScope.GLOBAL);
});
2019-08-07 23:18:17 +02:00
}
-}
+} */
class NeverShowAgain {
2019-08-10 01:50:05 +02:00
@@ -185,7 +175,7 @@ class NeverShowAgain {
2019-08-07 23:18:17 +02:00
}
}
-export class Win3264BitContribution implements IWorkbenchContribution {
2019-08-10 01:50:05 +02:00
+/*export class Win3264BitContribution implements IWorkbenchContribution {
2019-08-07 23:18:17 +02:00
private static readonly KEY = 'update/win32-64bits';
private static readonly URL = 'https://code.visualstudio.com/updates/v1_15#_windows-64-bit';
2019-08-10 01:50:05 +02:00
@@ -224,7 +214,7 @@ export class Win3264BitContribution implements IWorkbenchContribution {
2019-08-07 23:18:17 +02:00
{ sticky: true }
);
}
-}
2019-08-10 01:50:05 +02:00
+}*/
2019-08-07 23:18:17 +02:00
export class UpdateContribution extends Disposable implements IWorkbenchContribution {
2019-08-10 01:50:05 +02:00
@@ -234,13 +224,14 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-07 23:18:17 +02:00
constructor(
@IStorageService private readonly storageService: IStorageService,
- @IInstantiationService private readonly instantiationService: IInstantiationService,
+ // @IInstantiationService private readonly instantiationService: IInstantiationService,
@INotificationService private readonly notificationService: INotificationService,
@IDialogService private readonly dialogService: IDialogService,
@IUpdateService private readonly updateService: IUpdateService,
2019-08-10 01:50:05 +02: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;
@@ -257,7 +248,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-07 23:18:17 +02: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
2019-08-10 01:50:05 +02:00
@@ -302,9 +293,9 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-07 23:18:17 +02: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.nameLong));
} 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.nameLong));
clazz = 'progress-badge';
}
2019-08-10 01:50:05 +02:00
@@ -350,14 +341,14 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-07 23:18:17 +02: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 }
);
}
2019-08-10 01:50:05 +02:00
@@ -370,30 +361,27 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-07 23:18:17 +02: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)
const neverShowAgain = new NeverShowAgain('update/win32-fast-updates', this.storageService);
2019-08-10 01:50:05 +02:00
@@ -404,7 +392,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-07 23:18:17 +02:00
const handle = this.notificationService.prompt(
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),
[{
label: nls.localize('neveragain', "Don't Show Again"),
isSecondary: true,
2019-08-10 01:50:05 +02:00
@@ -418,20 +406,17 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-07 23:18:17 +02: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 01:50:05 +02:00
+ run: () => { this.updateService.quitAndInstall(); window.location.reload(); }
2019-08-07 23:18:17 +02: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: () => {
2019-08-10 01:50:05 +02:00
@@ -440,19 +425,19 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-07 23:18:17 +02: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);
2019-08-10 01:50:05 +02:00
@@ -495,7 +480,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-07 23:18:17 +02:00
group: '5_update',
command: {
id: 'update.downloadNow',
- title: nls.localize('download update', "Download Update")
+ title: nls.localize('installUpdate...', "Install Update...")
},
when: CONTEXT_UPDATE_STATE.isEqualTo(StateType.AvailableForDownload)
});
2019-08-10 01:50:05 +02:00
@@ -532,7 +517,7 @@ export class UpdateContribution extends Disposable implements IWorkbenchContribu
2019-08-07 23:18:17 +02:00
when: CONTEXT_UPDATE_STATE.isEqualTo(StateType.Updating)
});
- CommandsRegistry.registerCommand('update.restart', () => this.updateService.quitAndInstall());
2019-08-10 01:50:05 +02:00
+ CommandsRegistry.registerCommand('update.restart', () => { this.updateService.quitAndInstall(); window.location.reload(); });
2019-08-07 23:18:17 +02:00
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
group: '5_update',
command: {
2019-08-10 01:50:05 +02:00
diff --git a/src/vs/workbench/contrib/webview/browser/pre/index.html b/src/vs/workbench/contrib/webview/browser/pre/index.html
index ac53ce590e..5411601483 100644
2019-08-10 01:50:05 +02:00
--- a/src/vs/workbench/contrib/webview/browser/pre/index.html
+++ b/src/vs/workbench/contrib/webview/browser/pre/index.html
@@ -4,7 +4,7 @@
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy"
- content="default-src 'none'; script-src 'self'; frame-src 'self'; style-src 'unsafe-inline'; worker-src 'self';" />
+ content="default-src 'none'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; frame-src 'self'; style-src 'self' 'unsafe-inline'; worker-src 'self'; img-src https: data:; font-src 'self';" />
2019-08-10 01:50:05 +02:00
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
diff --git a/src/vs/workbench/contrib/webview/browser/pre/main.js b/src/vs/workbench/contrib/webview/browser/pre/main.js
index 63585fc25c..16102b89f1 100644
--- a/src/vs/workbench/contrib/webview/browser/pre/main.js
+++ b/src/vs/workbench/contrib/webview/browser/pre/main.js
@@ -256,7 +256,7 @@
*/
function toContentHtml(data) {
const options = data.options;
- const text = data.contents;
+ const text = data.contents.replace(/vscode-resource:/g, "'self'");
const newDocument = new DOMParser().parseFromString(text, 'text/html');
newDocument.querySelectorAll('a').forEach(a => {
@@ -379,7 +379,7 @@
2019-08-10 01:50:05 +02: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/welcome/walkThrough/browser/editor/editorWalkThrough.ts b/src/vs/workbench/contrib/welcome/walkThrough/browser/editor/editorWalkThrough.ts
index 7a95ffda9e..fdb14da4ee 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,7 @@ 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.href.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-08-10 01:50:05 +02:00
index 73e8b7c1d1..653d88e4f4 100644
--- a/src/vs/workbench/services/environment/browser/environmentService.ts
+++ b/src/vs/workbench/services/environment/browser/environmentService.ts
2019-08-10 01:50:05 +02:00
@@ -176,6 +176,8 @@ export class BrowserWorkbenchEnvironmentService implements IEnvironmentService {
driverVerbose: boolean;
webviewEndpoint?: string;
2019-08-10 01:50:05 +02:00
galleryMachineIdResource?: URI;
+ extraExtensionPaths: string[];
+ extraBuiltinExtensionPaths: string[];
get webviewResourceRoot(): string {
2019-08-10 01:50:05 +02:00
return this.webviewEndpoint ? this.webviewEndpoint + '/vscode-resource{{resource}}' : 'vscode-resource:{{resource}}';
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-08-10 01:50:05 +02:00
index 4d5cf7bfbf..bc76a25106 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-08-10 01:50:05 +02:00
@@ -126,7 +126,6 @@ import 'vs/workbench/services/extensionManagement/common/extensionEnablementServ
2019-07-10 23:29:15 +02:00
// import 'vs/workbench/services/remote/electron-browser/remoteAgentServiceImpl';
import 'vs/workbench/services/notification/common/notificationService';
// import 'vs/workbench/services/window/electron-browser/windowService';
2019-08-10 01:50:05 +02:00
-import 'vs/workbench/services/telemetry/browser/telemetryService';
import 'vs/workbench/services/configurationResolver/browser/configurationResolverService';
import { IContextViewService, IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { ContextMenuService } from 'vs/platform/contextview/browser/contextMenuService';
@@ -195,7 +194,7 @@ import 'vs/workbench/services/files/common/workspaceWatcher';
import 'vs/workbench/contrib/telemetry/browser/telemetry.contribution';
// Localizations
-// import 'vs/workbench/contrib/localizations/browser/localizations.contribution';
+import 'vs/workbench/contrib/localizations/browser/localizations.contribution';
// Preferences
import 'vs/workbench/contrib/preferences/browser/preferences.contribution';