提交 44762243 编写于 作者: D Dirk Baeumer

Remove ProblemMatchers from API.

上级 e81c07d7
......@@ -3509,215 +3509,6 @@ declare module 'vscode' {
update(key: string, value: any): Thenable<void>;
}
/**
* 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?: DiagnosticSeverity;
/**
* A background monitor for tasks that are running in the background.
*/
backgound?: BackgroundMonitor;
}
/**
* Controls the behaviour of the terminal's visibility.
*/
......@@ -3797,7 +3588,7 @@ declare module 'vscode' {
/**
* The ProblemMatchers type definition.
*/
export type ProblemMatchers = string | ProblemMatcher | (string | ProblemMatcher)[];
export type ProblemMatchers = string | string[];
/**
* A task that starts an external process.
......@@ -3881,7 +3672,7 @@ declare module 'vscode' {
* The problem matchers attached to the task. Defaults to an empty
* array.
*/
problemMatchers: (string | ProblemMatcher)[];
problemMatchers: string[];
}
export type ShellOptions = {
......@@ -4001,7 +3792,7 @@ declare module 'vscode' {
* The problem matchers attached to the task. Defaults to an empty
* array.
*/
problemMatchers: (string | ProblemMatcher)[];
problemMatchers: string[];
}
export type Task = ProcessTask | ShellTask;
......
......@@ -536,8 +536,6 @@ export function createApiFactory(
TreeItemCollapsibleState: extHostTypes.TreeItemCollapsibleState,
ThemeColor: extHostTypes.ThemeColor,
// functions
FileLocationKind: extHostTypes.FileLocationKind,
ApplyToKind: extHostTypes.ApplyToKind,
RevealKind: extHostTypes.RevealKind,
TaskGroup: extHostTypes.TaskGroup,
ShellTask: extHostTypes.ShellTask,
......
......@@ -8,13 +8,11 @@ import { TPromise } from 'vs/base/common/winjs.base';
import * as UUID from 'vs/base/common/uuid';
import { asWinJsPromise } from 'vs/base/common/async';
import * as Problems from 'vs/platform/markers/common/problemMatcher';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import * as TaskSystem from 'vs/workbench/parts/tasks/common/tasks';
import { IThreadService } from 'vs/workbench/services/thread/common/threadService';
import { MainContext, MainThreadTaskShape, ExtHostTaskShape } from 'vs/workbench/api/node/extHost.protocol';
import { fromDiagnosticSeverity } from 'vs/workbench/api/node/extHostTypeConverters';
import * as types from 'vs/workbench/api/node/extHostTypes';
import * as vscode from 'vscode';
......@@ -23,6 +21,7 @@ interface StringMap<V> {
[key: string]: V;
}
/*
namespace ProblemPattern {
export function from(value: vscode.ProblemPattern | vscode.MultiLineProblemPattern): Problems.ProblemPattern | Problems.MultiLineProblemPattern {
if (value === void 0 || value === null) {
......@@ -144,7 +143,7 @@ namespace WatchingPattern {
}
}
namespace WathingMatcher {
namespace BackgroundMonitor {
export function from(value: vscode.BackgroundMonitor): Problems.WatchingMatcher {
if (value === void 0 || value === null) {
return undefined;
......@@ -190,6 +189,7 @@ namespace ProblemMatcher {
return result;
}
}
*/
namespace RevealKind {
export function from(value: vscode.RevealKind): TaskSystem.ShowOutput {
......@@ -314,7 +314,7 @@ namespace Tasks {
showOutput: behaviour.showOutput,
isBackground: !!task.isBackground,
suppressTaskName: true,
problemMatchers: ProblemMatcher.from(task.problemMatchers)
problemMatchers: task.problemMatchers.slice()
};
return result;
}
......
......@@ -1018,12 +1018,12 @@ export enum RevealKind {
export class BaseTask {
private _name: string;
private _problemMatchers: (string | vscode.ProblemMatcher)[];
private _problemMatchers: string[];
private _identifier: string;
private _isBackground: boolean;
private _terminal: vscode.TerminalBehaviour;
constructor(name: string, problemMatchers: (string | vscode.ProblemMatcher)[]) {
constructor(name: string, problemMatchers: string[]) {
if (typeof name !== 'string') {
throw illegalArgument('name');
}
......@@ -1074,11 +1074,11 @@ export class BaseTask {
this._terminal = value;
}
get problemMatchers(): (string | vscode.ProblemMatcher)[] {
get problemMatchers(): string[] {
return this._problemMatchers;
}
set problemMatchers(value: (string | vscode.ProblemMatcher)[]) {
set problemMatchers(value: string[]) {
if (!Array.isArray(value)) {
value = [];
}
......@@ -1086,12 +1086,14 @@ export class BaseTask {
}
}
/*
namespace ProblemMatcher {
export function is(value: any): value is vscode.ProblemMatcher {
let candidate: vscode.ProblemMatcher = value;
return candidate && !!candidate.pattern;
}
}
*/
namespace ShellOptions {
export function is(value: any): value is vscode.ShellOptions {
......@@ -1144,7 +1146,7 @@ export class ProcessTask extends BaseTask {
args = arg3 || [];
if (arg4) {
if (Array.isArray(arg4) || typeof arg4 === 'string' || ProblemMatcher.is(arg4)) {
if (Array.isArray(arg4) || typeof arg4 === 'string') {
problemMatchers = arg4;
} else {
options = arg4;
......@@ -1153,8 +1155,8 @@ export class ProcessTask extends BaseTask {
if (arg5 && !problemMatchers) {
problemMatchers = arg5;
}
let pm: (string | vscode.ProblemMatcher)[];
if (problemMatchers && (typeof problemMatchers === 'string' || ProblemMatcher.is(problemMatchers))) {
let pm: string[];
if (problemMatchers && (typeof problemMatchers === 'string')) {
pm = [problemMatchers];
} else if (Array.isArray(problemMatchers)) {
pm = problemMatchers;
......@@ -1217,13 +1219,13 @@ export class ShellTask extends BaseTask implements vscode.ShellTask {
throw illegalArgument('commandLine');
}
let options: vscode.ShellOptions = undefined;
let pm: (string | vscode.ProblemMatcher)[];
let pm: string[];
if (ShellOptions.is(optionsOrProblemMatchers)) {
options = optionsOrProblemMatchers;
} else {
problemMatchers = optionsOrProblemMatchers;
}
if (problemMatchers && (typeof problemMatchers === 'string' || ProblemMatcher.is(problemMatchers))) {
if (problemMatchers && (typeof problemMatchers === 'string')) {
pm = [problemMatchers];
} else if (Array.isArray(problemMatchers)) {
pm = problemMatchers;
......
/*---------------------------------------------------------------------------------------------
* 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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册