Support controling the URI generated by problem matchers

This commit is contained in:
Dirk Baeumer 2018-06-18 12:22:49 +02:00
parent 36cab98dc0
commit c1e5c804cf
5 changed files with 15 additions and 9 deletions

View file

@ -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[] = [];

View file

@ -106,5 +106,8 @@ export interface TaskFilterDTO {
}
export interface TaskSystemInfoDTO {
scheme: string;
host: string;
port: number;
platform: string;
}

View 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);
}

View file

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

View file

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