diff --git a/extensions/merge-conflict/extension-browser.webpack.config.js b/extensions/merge-conflict/extension-browser.webpack.config.js new file mode 100644 index 00000000000..3bc5f783258 --- /dev/null +++ b/extensions/merge-conflict/extension-browser.webpack.config.js @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +//@ts-check + +'use strict'; + +const withDefaults = require('../shared.webpack.config'); +const path = require('path'); + +const clientConfig = withDefaults({ + target: 'webworker', + context: __dirname, + entry: { + extension: './src/mergeConflictMain.ts' + }, + output: { + filename: 'mergeConflictMain.js' + }, + performance: { + hints: false + }, + resolve: { + alias: { + 'vscode-nls': path.resolve(__dirname, '../../build/polyfills/vscode-nls.js') + } + } +}); +clientConfig.module.rules[0].use.shift(); // remove nls loader + +module.exports = clientConfig; diff --git a/extensions/merge-conflict/extension.webpack.config.js b/extensions/merge-conflict/extension.webpack.config.js index 45600607fc5..7a04ca98e97 100644 --- a/extensions/merge-conflict/extension.webpack.config.js +++ b/extensions/merge-conflict/extension.webpack.config.js @@ -12,6 +12,9 @@ const withDefaults = require('../shared.webpack.config'); module.exports = withDefaults({ context: __dirname, entry: { - extension: './src/extension.ts' - } + extension: './src/mergeConflictMain.ts' + }, + output: { + filename: 'mergeConflictMain.js' + }, }); diff --git a/extensions/merge-conflict/package.json b/extensions/merge-conflict/package.json index 815a412492a..f59738d3008 100644 --- a/extensions/merge-conflict/package.json +++ b/extensions/merge-conflict/package.json @@ -16,7 +16,8 @@ "activationEvents": [ "*" ], - "main": "./out/extension", + "main": "./out/mergeConflictMain", + "browser": "./dist/mergeConflictMain", "scripts": { "compile": "gulp compile-extension:merge-conflict", "watch": "gulp watch-extension:merge-conflict" diff --git a/extensions/merge-conflict/src/commandHandler.ts b/extensions/merge-conflict/src/commandHandler.ts index f79c6650af0..ca45b9a16f8 100644 --- a/extensions/merge-conflict/src/commandHandler.ts +++ b/extensions/merge-conflict/src/commandHandler.ts @@ -5,7 +5,6 @@ import * as vscode from 'vscode'; import * as interfaces from './interfaces'; import ContentProvider from './contentProvider'; -import * as path from 'path'; import { loadMessageBundle } from 'vscode-nls'; const localize = loadMessageBundle(); @@ -86,7 +85,6 @@ export default class CommandHandler implements vscode.Disposable { } async compare(editor: vscode.TextEditor, conflict: interfaces.IDocumentMergeConflict | null) { - const fileName = path.basename(editor.document.uri.fsPath); // No conflict, command executed from command palette if (!conflict) { @@ -134,6 +132,8 @@ export default class CommandHandler implements vscode.Disposable { conflict.range.start.line - mergeConflictLineOffsets, conflict.range.start.character ); + const docPath = editor.document.uri.path; + const fileName = docPath.substring(docPath.lastIndexOf('/') + 1); // avoid NodeJS path to keep browser webpack small const title = localize('compareChangesTitle', '{0}: Current Changes ⟷ Incoming Changes', fileName); const mergeConflictConfig = vscode.workspace.getConfiguration('merge-conflict'); const openToTheSide = mergeConflictConfig.get('diffViewPosition'); @@ -365,4 +365,4 @@ export default class CommandHandler implements vscode.Disposable { conflict: fallback() }; } -} \ No newline at end of file +} diff --git a/extensions/merge-conflict/src/extension.ts b/extensions/merge-conflict/src/mergeConflictMain.ts similarity index 100% rename from extensions/merge-conflict/src/extension.ts rename to extensions/merge-conflict/src/mergeConflictMain.ts diff --git a/resources/serverless/code-web.js b/resources/serverless/code-web.js index 2e69b9373b6..d4314c5c3f0 100644 --- a/resources/serverless/code-web.js +++ b/resources/serverless/code-web.js @@ -122,7 +122,8 @@ async function initialize() { packageJSON.extensionKind = ['web']; // enable for Web staticExtensions.push({ packageJSON, - extensionLocation: { scheme: SCHEME, authority: AUTHORITY, path: `/static-extension/${extensionFolder}` } + extensionLocation: { scheme: SCHEME, authority: AUTHORITY, path: `/static-extension/${extensionFolder}` }, + isBuiltin: true }); } catch (e) { console.log(e); diff --git a/src/vs/workbench/services/extensions/common/staticExtensions.ts b/src/vs/workbench/services/extensions/common/staticExtensions.ts index 6de07f59264..2c8631126a6 100644 --- a/src/vs/workbench/services/extensions/common/staticExtensions.ts +++ b/src/vs/workbench/services/extensions/common/staticExtensions.ts @@ -27,6 +27,7 @@ export class StaticExtensionsService implements IStaticExtensionsService { this._descriptions = staticExtensions.map(data => { identifier: new ExtensionIdentifier(`${data.packageJSON.publisher}.${data.packageJSON.name}`), extensionLocation: data.extensionLocation, + isBuiltin: !!data.isBuiltin, ...data.packageJSON, }); } diff --git a/src/vs/workbench/workbench.web.api.ts b/src/vs/workbench/workbench.web.api.ts index 905dbb195c8..3a9b9113d12 100644 --- a/src/vs/workbench/workbench.web.api.ts +++ b/src/vs/workbench/workbench.web.api.ts @@ -25,6 +25,7 @@ interface IResourceUriProvider { interface IStaticExtension { packageJSON: IExtensionManifest; extensionLocation: URI; + isBuiltin?: boolean; } interface ICommontTelemetryPropertiesResolver {