make merge-conflic serverless

This commit is contained in:
Martin Aeschlimann 2020-06-12 11:03:52 +02:00
parent 0c9c4dfbbc
commit d78d88f7a8
8 changed files with 47 additions and 7 deletions

View File

@ -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;

View File

@ -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'
},
});

View File

@ -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"

View File

@ -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<string>('diffViewPosition');
@ -365,4 +365,4 @@ export default class CommandHandler implements vscode.Disposable {
conflict: fallback()
};
}
}
}

View File

@ -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);

View File

@ -27,6 +27,7 @@ export class StaticExtensionsService implements IStaticExtensionsService {
this._descriptions = staticExtensions.map(data => <IExtensionDescription>{
identifier: new ExtensionIdentifier(`${data.packageJSON.publisher}.${data.packageJSON.name}`),
extensionLocation: data.extensionLocation,
isBuiltin: !!data.isBuiltin,
...data.packageJSON,
});
}

View File

@ -25,6 +25,7 @@ interface IResourceUriProvider {
interface IStaticExtension {
packageJSON: IExtensionManifest;
extensionLocation: URI;
isBuiltin?: boolean;
}
interface ICommontTelemetryPropertiesResolver {