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

Support controling the URI generated by problem matchers

上级 36cab98d
......@@ -494,7 +494,9 @@ export class MainThreadTask implements MainThreadTaskShape {
}
this._taskService.registerTaskSystem(key, {
platform: platform,
fileSystemScheme: key,
uriProvider: (path: string): URI => {
return URI.parse(`${info.scheme}://${info.host}:${info.port}${path}`);
},
context: this._extHostContext,
resolveVariables: (workspaceFolder: IWorkspaceFolder, variables: Set<string>): TPromise<Map<string, string>> => {
let vars: string[] = [];
......
......@@ -106,5 +106,8 @@ export interface TaskFilterDTO {
}
export interface TaskSystemInfoDTO {
scheme: string;
host: string;
port: number;
platform: string;
}
\ No newline at end of file
......@@ -134,7 +134,7 @@ export interface ProblemMatcher {
pattern: ProblemPattern | ProblemPattern[];
severity?: Severity;
watching?: WatchingMatcher;
fileSystemScheme?: string;
uriProvider?: (path: string) => URI;
}
export interface NamedProblemMatcher extends ProblemMatcher {
......@@ -196,8 +196,8 @@ export function getResource(filename: string, matcher: ProblemMatcher): URI {
if (fullPath[0] !== '/') {
fullPath = '/' + fullPath;
}
if (matcher.fileSystemScheme !== void 0) {
return URI.parse(`${matcher.fileSystemScheme}://${fullPath}`);
if (matcher.uriProvider !== void 0) {
return matcher.uriProvider(fullPath);
} else {
return URI.file(fullPath);
}
......
......@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
import URI from 'vs/base/common/uri';
import Severity from 'vs/base/common/severity';
import { TPromise } from 'vs/base/common/winjs.base';
import { TerminateResponse } from 'vs/base/common/processes';
......@@ -103,9 +104,9 @@ export interface TaskTerminateResponse extends TerminateResponse {
}
export interface TaskSystemInfo {
fileSystemScheme: string;
platform: Platform;
context: any;
uriProvider: (this: void, path: string) => URI;
resolveVariables(workspaceFolder: IWorkspaceFolder, variables: Set<string>): TPromise<Map<string, string>>;
}
......
......@@ -970,13 +970,13 @@ export class TerminalTaskSystem implements ITaskSystem {
}
let taskSystemInfo: TaskSystemInfo = resolver.taskSystemInfo;
let hasFilePrefix = matcher.filePrefix !== void 0;
let hasScheme = taskSystemInfo !== void 0 && taskSystemInfo.fileSystemScheme !== void 0 && taskSystemInfo.fileSystemScheme !== 'file';
if (!hasFilePrefix && !hasScheme) {
let hasUriProvider = taskSystemInfo !== void 0 && taskSystemInfo.uriProvider !== void 0;
if (!hasFilePrefix && !hasUriProvider) {
result.push(matcher);
} else {
let copy = Objects.deepClone(matcher);
if (hasScheme) {
copy.fileSystemScheme = taskSystemInfo.fileSystemScheme;
if (hasUriProvider) {
copy.uriProvider = taskSystemInfo.uriProvider;
}
if (hasFilePrefix) {
copy.filePrefix = this.resolveVariable(resolver, copy.filePrefix);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册