Merge from master

This commit is contained in:
Raj Musuku
2019-02-21 17:56:04 -08:00
parent 5a146e34fa
commit 666ae11639
11482 changed files with 119352 additions and 255574 deletions

View File

@@ -1,2 +1,5 @@
src/**
tsconfig.json
tsconfig.json
out/**
extension.webpack.config.js
yarn.lock

View File

@@ -0,0 +1,17 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//@ts-check
'use strict';
const withDefaults = require('../shared.webpack.config');
module.exports = withDefaults({
context: __dirname,
entry: {
extension: './src/extension.ts'
}
});

View File

@@ -79,10 +79,24 @@
{
"category": "%command.category%",
"title": "%command.compare%",
"original":"Compare Current Conflict",
"original": "Compare Current Conflict",
"command": "merge-conflict.compare"
}
],
"menus": {
"scm/resourceState/context": [
{
"command": "merge-conflict.accept.all-current",
"when": "scmProvider == git && scmResourceGroup == merge",
"group": "1_modification"
},
{
"command": "merge-conflict.accept.all-incoming",
"when": "scmProvider == git && scmResourceGroup == merge",
"group": "1_modification"
}
]
},
"configuration": {
"title": "%config.title%",
"properties": {
@@ -95,14 +109,19 @@
"type": "boolean",
"description": "%config.decoratorsEnabled%",
"default": true
},
"merge-conflict.autoNavigateNextConflict.enabled": {
"type": "boolean",
"description": "%config.autoNavigateNextConflictEnabled%",
"default": false
}
}
}
},
"dependencies": {
"vscode-nls": "^3.2.4"
"vscode-nls": "^4.0.0"
},
"devDependencies": {
"@types/node": "8.0.33"
}
}
}

View File

@@ -13,6 +13,7 @@
"command.previous": "Previous Conflict",
"command.compare": "Compare Current Conflict",
"config.title": "Merge Conflict",
"config.autoNavigateNextConflictEnabled": "Whether to automatically navigate to the next merge conflict after resolving a merge conflict.",
"config.codeLensEnabled": "Create a Code Lens for merge conflict blocks within editor.",
"config.decoratorsEnabled": "Create decorators for merge conflict blocks within editor."
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -158,6 +158,11 @@ export default class CommandHandler implements vscode.Disposable {
let navigationResult = await this.findConflictForNavigation(editor, direction);
if (!navigationResult) {
// Check for autoNavigateNextConflict, if it's enabled(which indicating no conflict remain), then do not show warning
const mergeConflictConfig = vscode.workspace.getConfiguration('merge-conflict');
if (mergeConflictConfig.get<boolean>('autoNavigateNextConflict.enabled')) {
return;
}
vscode.window.showWarningMessage(localize('noConflicts', 'No merge conflicts found in this file'));
return;
}
@@ -196,6 +201,13 @@ export default class CommandHandler implements vscode.Disposable {
// Tracker can forget as we know we are going to do an edit
this.tracker.forget(editor.document);
conflict.commitEdit(type, editor);
// navigate to the next merge conflict
const mergeConflictConfig = vscode.workspace.getConfiguration('merge-conflict');
if (mergeConflictConfig.get<boolean>('autoNavigateNextConflict.enabled')) {
this.navigateNext(editor);
}
}
private async acceptAll(type: interfaces.CommitType, editor: vscode.TextEditor): Promise<void> {

View File

@@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as vscode from 'vscode';
export default class MergeConflictContentProvider implements vscode.TextDocumentContentProvider, vscode.Disposable {

View File

@@ -2,7 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
export interface ITask<T> {
(): T;

View File

@@ -11,7 +11,7 @@ export interface IMergeRegion {
decoratorContent: vscode.Range;
}
export enum CommitType {
export const enum CommitType {
Current,
Incoming,
Both

View File

@@ -188,9 +188,9 @@ export default class MergeDecorator implements vscode.Disposable {
// Store decorations keyed by the type of decoration, set decoration wants a "style"
// to go with it, which will match this key (see constructor);
let matchDecorations: { [key: string]: vscode.DecorationOptions[] } = {};
let matchDecorations: { [key: string]: vscode.Range[] } = {};
let pushDecoration = (key: string, d: vscode.DecorationOptions) => {
let pushDecoration = (key: string, d: vscode.Range) => {
matchDecorations[key] = matchDecorations[key] || [];
matchDecorations[key].push(d);
};
@@ -198,25 +198,25 @@ export default class MergeDecorator implements vscode.Disposable {
conflicts.forEach(conflict => {
// TODO, this could be more effective, just call getMatchPositions once with a map of decoration to position
if (!conflict.current.decoratorContent.isEmpty) {
pushDecoration('current.content', { range: conflict.current.decoratorContent });
pushDecoration('current.content', conflict.current.decoratorContent);
}
if (!conflict.incoming.decoratorContent.isEmpty) {
pushDecoration('incoming.content', { range: conflict.incoming.decoratorContent });
pushDecoration('incoming.content', conflict.incoming.decoratorContent);
}
conflict.commonAncestors.forEach(commonAncestorsRegion => {
if (!commonAncestorsRegion.decoratorContent.isEmpty) {
pushDecoration('commonAncestors.content', { range: commonAncestorsRegion.decoratorContent });
pushDecoration('commonAncestors.content', commonAncestorsRegion.decoratorContent);
}
});
if (this.config!.enableDecorations) {
pushDecoration('current.header', { range: conflict.current.header });
pushDecoration('splitter', { range: conflict.splitter });
pushDecoration('incoming.header', { range: conflict.incoming.header });
pushDecoration('current.header', conflict.current.header);
pushDecoration('splitter', conflict.splitter);
pushDecoration('incoming.header', conflict.incoming.header);
conflict.commonAncestors.forEach(commonAncestorsRegion => {
pushDecoration('commonAncestors.header', { range: commonAncestorsRegion.header });
pushDecoration('commonAncestors.header', commonAncestorsRegion.header);
});
}
});

View File

@@ -1,19 +1,9 @@
{
"extends": "../shared.tsconfig.json",
"compilerOptions": {
"target": "es6",
"lib": [
"es2016"
],
"module": "commonjs",
"outDir": "./out",
"noImplicitAny": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true,
"experimentalDecorators": true
"outDir": "./out"
},
"include": [
"src/**/*"
]
}
}

View File

@@ -7,7 +7,7 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.33.tgz#1126e94374014e54478092830704f6ea89df04cd"
integrity sha512-vmCdO8Bm1ExT+FWfC9sd9r4jwqM7o97gGy2WBshkkXbf/2nLAJQUrZfIhw27yVOtLUev6kSZc4cav/46KbDd8A==
vscode-nls@^3.2.4:
version "3.2.4"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-3.2.4.tgz#2166b4183c8aea884d20727f5449e62be69fd398"
integrity sha512-FTjdqa4jDDoBjJqr36O8lmmZf/55kQ2w4ZY/+GL6K92fq765BqO3aYw21atnXUno/P04V5DWagNl4ybDIndJsw==
vscode-nls@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-4.0.0.tgz#4001c8a6caba5cedb23a9c5ce1090395c0e44002"
integrity sha512-qCfdzcH+0LgQnBpZA53bA32kzp9rpq/f66Som577ObeuDlFIrtbEJ+A/+CCxjIh4G8dpJYNCKIsxpRAHIfsbNw==