提交 c3da0531 编写于 作者: J Joao Moreno

Merge remote-tracking branch 'origin/master'

......@@ -15,8 +15,8 @@ function createStringSequence(a: string): ISequence {
};
}
export function stringDiff(original: string, modified: string): IDiffChange[] {
return new LcsDiff(createStringSequence(original), createStringSequence(modified)).ComputeDiff();
export function stringDiff(original: string, modified: string, pretty: boolean): IDiffChange[] {
return new LcsDiff(createStringSequence(original), createStringSequence(modified)).ComputeDiff(pretty);
}
......@@ -286,8 +286,16 @@ export class LcsDiff {
return this.m_originalIds[originalIndex] === this.m_modifiedIds[newIndex];
}
public ComputeDiff(): IDiffChange[] {
return this._ComputeDiff(0, this.OriginalSequence.getLength() - 1, 0, this.ModifiedSequence.getLength() - 1);
private OriginalElementsAreEqual(index1: number, index2: number): boolean {
return this.m_originalIds[index1] === this.m_originalIds[index2];
}
private ModifiedElementsAreEqual(index1: number, index2: number): boolean {
return this.m_modifiedIds[index1] === this.m_modifiedIds[index2];
}
public ComputeDiff(pretty: boolean): IDiffChange[] {
return this._ComputeDiff(0, this.OriginalSequence.getLength() - 1, 0, this.ModifiedSequence.getLength() - 1, pretty);
}
/**
......@@ -295,9 +303,18 @@ export class LcsDiff {
* sequences on the bounded range.
* @returns An array of the differences between the two input sequences.
*/
private _ComputeDiff(originalStart: number, originalEnd: number, modifiedStart: number, modifiedEnd: number): DiffChange[] {
private _ComputeDiff(originalStart: number, originalEnd: number, modifiedStart: number, modifiedEnd: number, pretty: boolean): DiffChange[] {
let quitEarlyArr = [false];
return this.ComputeDiffRecursive(originalStart, originalEnd, modifiedStart, modifiedEnd, quitEarlyArr);
let changes = this.ComputeDiffRecursive(originalStart, originalEnd, modifiedStart, modifiedEnd, quitEarlyArr);
if (pretty) {
// We have to clean up the computed diff to be more intuitive
// but it turns out this cannot be done correctly until the entire set
// of diffs have been computed
return this.ShiftChanges(changes);
}
return changes;
}
/**
......@@ -769,6 +786,153 @@ export class LcsDiff {
);
}
/**
* Shifts the given changes to provide a more intuitive diff.
* While the first element in a diff matches the first element after the diff,
* we shift the diff down.
*
* @param changes The list of changes to shift
* @returns The shifted changes
*/
private ShiftChanges(changes: DiffChange[]): DiffChange[] {
let mergedDiffs: boolean;
do {
mergedDiffs = false;
// Shift all the changes down first
for (let i = 0; i < changes.length; i++) {
const change = changes[i];
const originalStop = (i < changes.length - 1) ? changes[i + 1].originalStart : this.OriginalSequence.getLength();
const modifiedStop = (i < changes.length - 1) ? changes[i + 1].modifiedStart : this.ModifiedSequence.getLength();
const checkOriginal = change.originalLength > 0;
const checkModified = change.modifiedLength > 0;
while (change.originalStart + change.originalLength < originalStop &&
change.modifiedStart + change.modifiedLength < modifiedStop &&
(!checkOriginal || this.OriginalElementsAreEqual(change.originalStart, change.originalStart + change.originalLength)) &&
(!checkModified || this.ModifiedElementsAreEqual(change.modifiedStart, change.modifiedStart + change.modifiedLength))) {
change.originalStart++;
change.modifiedStart++;
}
}
// Build up the new list (we have to build a new list because we
// might have changes we can merge together now)
let result = new Array<DiffChange>();
let mergedChangeArr: DiffChange[] = [null];
for (let i = 0; i < changes.length; i++) {
if (i < changes.length - 1 && this.ChangesOverlap(changes[i], changes[i + 1], mergedChangeArr)) {
mergedDiffs = true;
result.push(mergedChangeArr[0]);
i++;
}
else {
result.push(changes[i]);
}
}
changes = result;
} while (mergedDiffs);
// Shift changes back up until we hit empty or whitespace-only lines
for (let i = changes.length - 1; i >= 0; i--) {
const change = changes[i];
let originalStop = 0;
let modifiedStop = 0;
if (i > 0) {
const prevChange = changes[i - 1];
if (prevChange.originalLength > 0) {
originalStop = prevChange.originalStart + prevChange.originalLength;
}
if (prevChange.modifiedLength > 0) {
modifiedStop = prevChange.modifiedStart + prevChange.modifiedLength;
}
}
const checkOriginal = change.originalLength > 0;
const checkModified = change.modifiedLength > 0;
let bestDelta = 0;
let bestScore = this._boundaryScore(change.originalStart, change.originalLength, change.modifiedStart, change.modifiedLength);
for (let delta = 1; ; delta++) {
let originalStart = change.originalStart - delta;
let modifiedStart = change.modifiedStart - delta;
if (originalStart < originalStop || modifiedStart < modifiedStart) {
break;
}
if (checkOriginal && !this.OriginalElementsAreEqual(originalStart, originalStart + change.originalLength)) {
break;
}
if (checkModified && !this.ModifiedElementsAreEqual(modifiedStart, modifiedStart + change.modifiedLength)) {
break;
}
let score = this._boundaryScore(originalStart, change.originalLength, modifiedStart, change.modifiedLength);
if (score > bestScore) {
bestScore = score;
bestDelta = delta;
}
}
change.originalStart -= bestDelta;
change.modifiedStart -= bestDelta;
}
return changes;
}
private _OriginalIsBoundary(index: number): boolean {
if (index <= 0 || index >= this.OriginalSequence.getLength() - 1) {
return true;
}
return /^\s*$/.test(this.OriginalSequence.getElementHash(index));
}
private _OriginalRegionIsBoundary(originalStart: number, originalLength: number): boolean {
if (this._OriginalIsBoundary(originalStart) || this._OriginalIsBoundary(originalStart - 1)) {
return true;
}
if (originalLength > 0) {
let originalEnd = originalStart + originalLength;
if (this._OriginalIsBoundary(originalEnd - 1) || this._OriginalIsBoundary(originalEnd)) {
return true;
}
}
return false;
}
private _ModifiedIsBoundary(index: number): boolean {
if (index <= 0 || index >= this.ModifiedSequence.getLength() - 1) {
return true;
}
return /^\s*$/.test(this.ModifiedSequence.getElementHash(index));
}
private _ModifiedRegionIsBoundary(modifiedStart: number, modifiedLength: number): boolean {
if (this._ModifiedIsBoundary(modifiedStart) || this._ModifiedIsBoundary(modifiedStart - 1)) {
return true;
}
if (modifiedLength > 0) {
let modifiedEnd = modifiedStart + modifiedLength;
if (this._ModifiedIsBoundary(modifiedEnd - 1) || this._ModifiedIsBoundary(modifiedEnd)) {
return true;
}
}
return false;
}
private _boundaryScore(originalStart: number, originalLength: number, modifiedStart: number, modifiedLength: number): number {
let originalScore = (this._OriginalRegionIsBoundary(originalStart, originalLength) ? 1 : 0);
let modifiedScore = (this._ModifiedRegionIsBoundary(modifiedStart, modifiedLength) ? 1 : 0);
return (originalScore + modifiedScore);
}
/**
* Concatenates the two input DiffChange lists and returns the resulting
* list.
......@@ -847,7 +1011,6 @@ export class LcsDiff {
* @param numDiagonals The total number of diagonals.
* @returns The clipped diagonal index.
*/
private ClipDiagonalBound(diagonal: number, numDifferences: number, diagonalBaseIndex: number, numDiagonals: number): number {
if (diagonal >= 0 && diagonal < numDiagonals) {
// Nothing to clip, its in range
......@@ -868,5 +1031,4 @@ export class LcsDiff {
return (diffEven === upperBoundEven) ? numDiagonals - 1 : numDiagonals - 2;
}
}
}
\ No newline at end of file
}
......@@ -955,7 +955,7 @@ export class TreeView extends HeightMap {
getElementHash: (i: number) => afterModelItems[i].id
}, null);
diff = lcs.ComputeDiff();
diff = lcs.ComputeDiff(false);
// this means that the result of the diff algorithm would result
// in inserting items that were already registered. this can only
......
......@@ -143,7 +143,7 @@ suite('Diff - Ported from VS', () => {
// cancel processing
return false;
});
var changes = diff.ComputeDiff();
var changes = diff.ComputeDiff(true);
assert.equal(predicateCallCount, 1);
......@@ -159,7 +159,7 @@ suite('Diff - Ported from VS', () => {
// Continue processing as long as there hasn't been a match made.
return longestMatchSoFar < 1;
});
changes = diff.ComputeDiff();
changes = diff.ComputeDiff(true);
assertAnswer(left, right, changes, 'abcf');
......@@ -172,7 +172,7 @@ suite('Diff - Ported from VS', () => {
// Continue processing as long as there hasn't been a match made.
return longestMatchSoFar < 2;
});
changes = diff.ComputeDiff();
changes = diff.ComputeDiff(true);
assertAnswer(left, right, changes, 'abcdf');
......@@ -188,7 +188,7 @@ suite('Diff - Ported from VS', () => {
// Continue processing as long as there hasn't been a match made.
return !hitYet;
});
changes = diff.ComputeDiff();
changes = diff.ComputeDiff(true);
assertAnswer(left, right, changes, 'abcdf');
......@@ -201,7 +201,7 @@ suite('Diff - Ported from VS', () => {
// Continue processing as long as there hasn't been a match made.
return longestMatchSoFar < 3;
});
changes = diff.ComputeDiff();
changes = diff.ComputeDiff(true);
assertAnswer(left, right, changes, 'abcdef');
});
......
......@@ -313,7 +313,8 @@ export abstract class BaseEditorSimpleWorker {
let diffComputer = new DiffComputer(originalLines, modifiedLines, {
shouldPostProcessCharChanges: true,
shouldIgnoreTrimWhitespace: ignoreTrimWhitespace,
shouldConsiderTrimWhitespaceInEmptyCase: true
shouldConsiderTrimWhitespaceInEmptyCase: true,
shouldMakePrettyDiff: true
});
return TPromise.as(diffComputer.computeDiff());
}
......@@ -330,7 +331,8 @@ export abstract class BaseEditorSimpleWorker {
let diffComputer = new DiffComputer(originalLines, modifiedLines, {
shouldPostProcessCharChanges: false,
shouldIgnoreTrimWhitespace: ignoreTrimWhitespace,
shouldConsiderTrimWhitespaceInEmptyCase: false
shouldConsiderTrimWhitespaceInEmptyCase: false,
shouldMakePrettyDiff: true
});
return TPromise.as(diffComputer.computeDiff());
}
......@@ -377,7 +379,7 @@ export abstract class BaseEditorSimpleWorker {
}
// compute diff between original and edit.text
const changes = stringDiff(original, text);
const changes = stringDiff(original, text, false);
const editOffset = model.offsetAt(Range.lift(range).getStartPosition());
for (const change of changes) {
......
......@@ -55,7 +55,8 @@ function assertDiff(originalLines: string[], modifiedLines: string[], expectedCh
var diffComputer = new DiffComputer(originalLines, modifiedLines, {
shouldPostProcessCharChanges: shouldPostProcessCharChanges || false,
shouldIgnoreTrimWhitespace: shouldIgnoreTrimWhitespace || false,
shouldConsiderTrimWhitespaceInEmptyCase: true
shouldConsiderTrimWhitespaceInEmptyCase: true,
shouldMakePrettyDiff: true
});
var changes = diffComputer.computeDiff();
......@@ -458,4 +459,219 @@ suite('Editor Diff - DiffComputer', () => {
];
assertDiff(original, modified, expected, false, true);
});
test('pretty diff 1', () => {
var original = [
'suite(function () {',
' test1() {',
' assert.ok(true);',
' }',
'',
' test2() {',
' assert.ok(true);',
' }',
'});',
'',
];
var modified = [
'// An insertion',
'suite(function () {',
' test1() {',
' assert.ok(true);',
' }',
'',
' test2() {',
' assert.ok(true);',
' }',
'',
' test3() {',
' assert.ok(true);',
' }',
'});',
'',
];
var expected = [
createLineInsertion(1, 1, 0),
createLineInsertion(10, 13, 8)
];
assertDiff(original, modified, expected, false, true);
});
test('pretty diff 2', () => {
var original = [
'// Just a comment',
'',
'function compute(a, b, c, d) {',
' if (a) {',
' if (b) {',
' if (c) {',
' return 5;',
' }',
' }',
' // These next lines will be deleted',
' if (d) {',
' return -1;',
' }',
' return 0;',
' }',
'}',
];
var modified = [
'// Here is an inserted line',
'// and another inserted line',
'// and another one',
'// Just a comment',
'',
'function compute(a, b, c, d) {',
' if (a) {',
' if (b) {',
' if (c) {',
' return 5;',
' }',
' }',
' return 0;',
' }',
'}',
];
var expected = [
createLineInsertion(1, 3, 0),
createLineDeletion(10, 13, 12),
];
assertDiff(original, modified, expected, false, true);
});
test('pretty diff 3', () => {
var original = [
'class A {',
' /**',
' * m1',
' */',
' method1() {}',
'',
' /**',
' * m3',
' */',
' method3() {}',
'}',
];
var modified = [
'class A {',
' /**',
' * m1',
' */',
' method1() {}',
'',
' /**',
' * m2',
' */',
' method2() {}',
'',
' /**',
' * m3',
' */',
' method3() {}',
'}',
];
var expected = [
createLineInsertion(7, 11, 6)
];
assertDiff(original, modified, expected, false, true);
});
test('issue #23636', () => {
let original = [
'if(!TextDrawLoad[playerid])',
'{',
'',
' TextDrawHideForPlayer(playerid,TD_AppleJob[3]);',
' TextDrawHideForPlayer(playerid,TD_AppleJob[4]);',
' if(!AppleJobTreesType[AppleJobTreesPlayerNum[playerid]])',
' {',
' for(new i=0;i<10;i++) if(StatusTD_AppleJobApples[playerid][i]) TextDrawHideForPlayer(playerid,TD_AppleJob[5+i]);',
' }',
' else',
' {',
' for(new i=0;i<10;i++) if(StatusTD_AppleJobApples[playerid][i]) TextDrawHideForPlayer(playerid,TD_AppleJob[15+i]);',
' }',
'}',
'else',
'{',
' TextDrawHideForPlayer(playerid,TD_AppleJob[3]);',
' TextDrawHideForPlayer(playerid,TD_AppleJob[27]);',
' if(!AppleJobTreesType[AppleJobTreesPlayerNum[playerid]])',
' {',
' for(new i=0;i<10;i++) if(StatusTD_AppleJobApples[playerid][i]) TextDrawHideForPlayer(playerid,TD_AppleJob[28+i]);',
' }',
' else',
' {',
' for(new i=0;i<10;i++) if(StatusTD_AppleJobApples[playerid][i]) TextDrawHideForPlayer(playerid,TD_AppleJob[38+i]);',
' }',
'}',
];
let modified = [
' if(!TextDrawLoad[playerid])',
' {',
' ',
' TextDrawHideForPlayer(playerid,TD_AppleJob[3]);',
' TextDrawHideForPlayer(playerid,TD_AppleJob[4]);',
' if(!AppleJobTreesType[AppleJobTreesPlayerNum[playerid]])',
' {',
' for(new i=0;i<10;i++) if(StatusTD_AppleJobApples[playerid][i]) TextDrawHideForPlayer(playerid,TD_AppleJob[5+i]);',
' }',
' else',
' {',
' for(new i=0;i<10;i++) if(StatusTD_AppleJobApples[playerid][i]) TextDrawHideForPlayer(playerid,TD_AppleJob[15+i]);',
' }',
' }',
' else',
' {',
' TextDrawHideForPlayer(playerid,TD_AppleJob[3]);',
' TextDrawHideForPlayer(playerid,TD_AppleJob[27]);',
' if(!AppleJobTreesType[AppleJobTreesPlayerNum[playerid]])',
' {',
' for(new i=0;i<10;i++) if(StatusTD_AppleJobApples[playerid][i]) TextDrawHideForPlayer(playerid,TD_AppleJob[28+i]);',
' }',
' else',
' {',
' for(new i=0;i<10;i++) if(StatusTD_AppleJobApples[playerid][i]) TextDrawHideForPlayer(playerid,TD_AppleJob[38+i]);',
' }',
' }',
];
var expected = [
createLineChange(
1, 27, 1, 27,
[
createCharChange(1, 1, 1, 1, 1, 1, 1, 2),
createCharChange(2, 1, 2, 1, 2, 1, 2, 2),
createCharChange(3, 1, 3, 1, 3, 1, 3, 2),
createCharChange(4, 1, 4, 1, 4, 1, 4, 2),
createCharChange(5, 1, 5, 1, 5, 1, 5, 2),
createCharChange(6, 1, 6, 1, 6, 1, 6, 2),
createCharChange(7, 1, 7, 1, 7, 1, 7, 2),
createCharChange(8, 1, 8, 1, 8, 1, 8, 2),
createCharChange(9, 1, 9, 1, 9, 1, 9, 2),
createCharChange(10, 1, 10, 1, 10, 1, 10, 2),
createCharChange(11, 1, 11, 1, 11, 1, 11, 2),
createCharChange(12, 1, 12, 1, 12, 1, 12, 2),
createCharChange(13, 1, 13, 1, 13, 1, 13, 2),
createCharChange(14, 1, 14, 1, 14, 1, 14, 2),
createCharChange(15, 1, 15, 1, 15, 1, 15, 2),
createCharChange(16, 1, 16, 1, 16, 1, 16, 2),
createCharChange(17, 1, 17, 1, 17, 1, 17, 2),
createCharChange(18, 1, 18, 1, 18, 1, 18, 2),
createCharChange(19, 1, 19, 1, 19, 1, 19, 2),
createCharChange(20, 1, 20, 1, 20, 1, 20, 2),
createCharChange(21, 1, 21, 1, 21, 1, 21, 2),
createCharChange(22, 1, 22, 1, 22, 1, 22, 2),
createCharChange(23, 1, 23, 1, 23, 1, 23, 2),
createCharChange(24, 1, 24, 1, 24, 1, 24, 2),
createCharChange(25, 1, 25, 1, 25, 1, 25, 2),
createCharChange(26, 1, 26, 1, 26, 1, 26, 2),
createCharChange(27, 1, 27, 1, 27, 1, 27, 2),
]
)
// createLineInsertion(7, 11, 6)
];
assertDiff(original, modified, expected, true, false);
});
});
......@@ -5317,6 +5317,69 @@ declare module 'vscode' {
export function createSourceControl(id: string, label: string): SourceControl;
}
/**
* Configuration for a debug session.
*/
export interface DebugConfiguration {
/**
* The type for the debug session.
*/
type: string;
/**
* An optional name for the debug session.
*/
name?: string;
/**
* The request type of the debug session.
*/
request: string;
/**
* Additional debug type specific properties.
*/
[key: string]: any;
}
/**
* A debug session.
*/
export interface DebugSession {
/**
* The debug session's type from the debug configuration.
*/
readonly type: string;
/**
* The debug session's name from the debug configuration.
*/
readonly name: string;
/**
* Send a custom request to the debug adapter.
*/
customRequest(command: string, args?: any): Thenable<any>;
}
/**
* Namespace for dealing with debug sessions.
*/
export namespace debug {
/**
* An [event](#Event) which fires when a debug session has terminated.
*/
export const onDidTerminateDebugSession: Event<DebugSession>;
/**
* Create a new debug session based on the given configuration.
* @param configuration
*/
export function createDebugSession(configuration: DebugConfiguration): Thenable<DebugSession>;
}
/**
* Namespace for dealing with installed extensions. Extensions are represented
* by an [extension](#Extension)-interface which allows to reflect on them.
......
......@@ -189,67 +189,4 @@ declare module 'vscode' {
*/
onData(callback: (data: string) => any): void;
}
/**
* Namespace for dealing with debug sessions.
*/
export namespace debug {
/**
* An [event](#Event) which fires when a debug session has terminated.
*/
export const onDidTerminateDebugSession: Event<DebugSession>;
/**
* Create a new debug session based on the given launchConfig.
* @param launchConfig
*/
export function createDebugSession(launchConfig: DebugConfiguration): Thenable<DebugSession>;
}
/**
* Configuration for a debug session.
*/
export interface DebugConfiguration {
/**
* The type for the debug session.
*/
type: string;
/**
* An optional name for the debug session.
*/
name?: string;
/**
* The request type of the debug session.
*/
request: string;
/**
* Additional debug type specific properties.
*/
[key: string]: any;
}
/**
* A debug session.
*/
export interface DebugSession {
/**
* The debug session's type from the debug configuration.
*/
readonly type: string;
/**
* The debug session's name from the debug configuration.
*/
readonly name: string;
/**
* Send a custom request to the debug adapter.
*/
customRequest(command: string, args?: any): Thenable<any>;
}
}
......@@ -463,12 +463,12 @@ export function createApiFactory(
// namespace: debug
const debug: typeof vscode.debug = {
createDebugSession: proposedApiFunction(extension, (config: vscode.DebugConfiguration) => {
createDebugSession(config: vscode.DebugConfiguration) {
return extHostDebugService.createDebugSession(config);
}),
onDidTerminateDebugSession: proposedApiFunction(extension, (listener, thisArg?, disposables?) => {
},
onDidTerminateDebugSession(listener, thisArg?, disposables?) {
return extHostDebugService.onDidTerminateDebugSession(listener, thisArg, disposables);
})
}
};
......
......@@ -27,7 +27,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import { IExtensionsWorkbenchService, IExtensionsViewlet, VIEWLET_ID, ExtensionState } from '../common/extensions';
import {
ShowInstalledExtensionsAction, ShowRecommendedExtensionsAction, ShowWorkspaceRecommendedExtensionsAction, ShowRecommendedKeymapExtensionsAction, ShowPopularExtensionsAction, ShowDisabledExtensionsAction,
ShowInstalledExtensionsAction, ShowRecommendedExtensionsAction, ShowWorkspaceRecommendedExtensionsAction, ShowPopularExtensionsAction, ShowDisabledExtensionsAction,
ShowOutdatedExtensionsAction, ClearExtensionsInputAction, ChangeSortAction, UpdateAllAction, CheckForUpdatesAction, DisableAllAction, EnableAllAction,
EnableAutoUpdateAction, DisableAutoUpdateAction
} from 'vs/workbench/parts/extensions/browser/extensionsActions';
......@@ -269,7 +269,6 @@ export class ExtensionsViewlet extends ComposedViewsViewlet implements IExtensio
this.instantiationService.createInstance(ShowDisabledExtensionsAction, ShowDisabledExtensionsAction.ID, ShowDisabledExtensionsAction.LABEL),
this.instantiationService.createInstance(ShowRecommendedExtensionsAction, ShowRecommendedExtensionsAction.ID, ShowRecommendedExtensionsAction.LABEL),
this.instantiationService.createInstance(ShowWorkspaceRecommendedExtensionsAction, ShowWorkspaceRecommendedExtensionsAction.ID, ShowWorkspaceRecommendedExtensionsAction.LABEL),
this.instantiationService.createInstance(ShowRecommendedKeymapExtensionsAction, ShowRecommendedKeymapExtensionsAction.ID, ShowRecommendedKeymapExtensionsAction.LABEL),
this.instantiationService.createInstance(ShowPopularExtensionsAction, ShowPopularExtensionsAction.ID, ShowPopularExtensionsAction.LABEL),
new Separator(),
this.instantiationService.createInstance(ChangeSortAction, 'extensions.sort.install', localize('sort by installs', "Sort By: Install Count"), this.onSearchChange, 'installs'),
......
......@@ -271,9 +271,9 @@ export class ExtensionsListView extends CollapsibleView {
return this.extensionsWorkbenchService.queryLocal()
.then(result => result.filter(e => e.type === LocalExtensionType.User))
.then(local => {
return TPromise.join([TPromise.as(this.tipsService.getRecommendations()), this.tipsService.getWorkspaceRecommendations(), TPromise.as(this.tipsService.getKeymapRecommendations())])
.then(([recommendations, workspaceRecommendations, keymapsRecommendations]) => {
const names = distinct([...recommendations, ...workspaceRecommendations, ...keymapsRecommendations])
return TPromise.join([TPromise.as(this.tipsService.getRecommendations()), this.tipsService.getWorkspaceRecommendations()])
.then(([recommendations, workspaceRecommendations]) => {
const names = distinct([...recommendations, ...workspaceRecommendations])
.filter(name => local.every(ext => `${ext.publisher}.${ext.name}` !== name))
.filter(name => name.toLowerCase().indexOf(value) > -1);
......@@ -441,8 +441,7 @@ export class RecommendedExtensionsView extends ExtensionsListView {
public static isRecommendedExtensionsQuery(query: string): boolean {
return ExtensionsListView.isRecommendedExtensionsQuery(query)
|| ExtensionsListView.isWorkspaceRecommendedExtensionsQuery(query)
|| ExtensionsListView.isKeymapsRecommendedExtensionsQuery(query);
|| ExtensionsListView.isWorkspaceRecommendedExtensionsQuery(query);
}
async show(query: string): TPromise<IPagedModel<IExtension>> {
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* Defines a problem pattern
*/
export interface ProblemPattern {
/**
* The regular expression to find a problem in the console output of an
* executed task.
*/
regexp: RegExp;
/**
* The match group index of the filename.
*
* Defaults to 1 if omitted.
*/
file?: number;
/**
* The match group index of the problems's location. Valid location
* patterns are: (line), (line,column) and (startLine,startColumn,endLine,endColumn).
* If omitted the line and colum properties are used.
*/
location?: number;
/**
* The match group index of the problem's line in the source file.
*
* Defaults to 2 if omitted.
*/
line?: number;
/**
* The match group index of the problem's character in the source file.
*
* Defaults to 3 if omitted.
*/
character?: number;
/**
* The match group index of the problem's end line in the source file.
*
* Defaults to undefined. No end line is captured.
*/
endLine?: number;
/**
* The match group index of the problem's end character in the source file.
*
* Defaults to undefined. No end column is captured.
*/
endCharacter?: number;
/**
* The match group index of the problem's severity.
*
* Defaults to undefined. In this case the problem matcher's severity
* is used.
*/
severity?: number;
/**
* The match group index of the problems's code.
*
* Defaults to undefined. No code is captured.
*/
code?: number;
/**
* The match group index of the message. If omitted it defaults
* to 4 if location is specified. Otherwise it defaults to 5.
*/
message?: number;
/**
* Specifies if the last pattern in a multi line problem matcher should
* loop as long as it does match a line consequently. Only valid on the
* last problem pattern in a multi line problem matcher.
*/
loop?: boolean;
}
/**
* A multi line problem pattern.
*/
export type MultiLineProblemPattern = ProblemPattern[];
/**
* The way how the file location is interpreted
*/
export enum FileLocationKind {
/**
* VS Code should decide based on whether the file path found in the
* output is absolute or relative. A relative file path will be treated
* relative to the workspace root.
*/
Auto = 1,
/**
* Always treat the file path relative.
*/
Relative = 2,
/**
* Always treat the file path absolute.
*/
Absolute = 3
}
/**
* Controls to which kind of documents problems are applied.
*/
export enum ApplyToKind {
/**
* Problems are applied to all documents.
*/
AllDocuments = 1,
/**
* Problems are applied to open documents only.
*/
OpenDocuments = 2,
/**
* Problems are applied to closed documents only.
*/
ClosedDocuments = 3
}
/**
* A background monitor pattern
*/
export interface BackgroundPattern {
/**
* The actual regular expression
*/
regexp: RegExp;
/**
* The match group index of the filename. If provided the expression
* is matched for that file only.
*/
file?: number;
}
/**
* A description to control the activity of a problem matcher
* watching a background task.
*/
export interface BackgroundMonitor {
/**
* If set to true the monitor is in active mode when the task
* starts. This is equals of issuing a line that matches the
* beginPattern.
*/
activeOnStart?: boolean;
/**
* If matched in the output the start of a background activity is signaled.
*/
beginsPattern: RegExp | BackgroundPattern;
/**
* If matched in the output the end of a background activity is signaled.
*/
endsPattern: RegExp | BackgroundPattern;
}
/**
* Defines a problem matcher
*/
export interface ProblemMatcher {
/**
* The owner of a problem. Defaults to a generated id
* if omitted.
*/
owner?: string;
/**
* The type of documents problems detected by this matcher
* apply to. Default to `ApplyToKind.AllDocuments` if omitted.
*/
applyTo?: ApplyToKind;
/**
* How a file location recognized by a matcher should be interpreted. If omitted the file location
* if `FileLocationKind.Auto`.
*/
fileLocation?: FileLocationKind | string;
/**
* The actual pattern used by the problem matcher.
*/
pattern: ProblemPattern | MultiLineProblemPattern;
/**
* The default severity of a detected problem in the output. Used
* if the `ProblemPattern` doesn't define a severity match group.
*/
severity?: any;
/**
* A background monitor for tasks that are running in the background.
*/
backgound?: BackgroundMonitor;
}
\ No newline at end of file
......@@ -54,6 +54,7 @@ const msbuild: TaskEntry = {
'\t"tasks": [',
'\t\t{',
'\t\t\t"taskName": "build",',
'\t\t\t"type": "process",',
'\t\t\t"command": "msbuild",',
'\t\t\t"args": [',
'\t\t\t\t// Ask msbuild to generate full paths for file names.',
......@@ -86,8 +87,8 @@ const command: TaskEntry = {
'\t"tasks": [',
'\t\t{',
'\t\t\t"taskName": "echo",',
'\t\t\t"command": "echo Hello",',
'\t\t\t"type": "shell"',
'\t\t\t"type": "shell",',
'\t\t\t"command": "echo Hello"',
'\t\t}',
'\t]',
'}'
......@@ -108,14 +109,14 @@ const maven: TaskEntry = {
'\t"tasks": [',
'\t\t{',
'\t\t\t"taskName": "verify",',
'\t\t\t"command": "mvn -B verify",',
'\t\t\t"type": "shell",',
'\t\t\t"command": "mvn -B verify",',
'\t\t\t"group": "build"',
'\t\t},',
'\t\t{',
'\t\t\t"taskName": "test",',
'\t\t\t"command": "mvn -B test",',
'\t\t\t"type": "shell",',
'\t\t\t"command": "mvn -B test",',
'\t\t\t"group": "test"',
'\t\t}',
'\t]',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册