@theia/task 1.53.0-next.4 → 1.53.0-next.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +193 -193
- package/lib/browser/task-schema-updater.js +1 -1
- package/package.json +13 -13
- package/src/browser/index.ts +22 -22
- package/src/browser/process/process-task-contribution.ts +31 -31
- package/src/browser/process/process-task-frontend-module.ts +27 -27
- package/src/browser/process/process-task-resolver.ts +89 -89
- package/src/browser/provided-task-configurations.spec.ts +46 -46
- package/src/browser/provided-task-configurations.ts +213 -213
- package/src/browser/quick-open-task.ts +831 -831
- package/src/browser/style/index.css +19 -19
- package/src/browser/task-configuration-manager.ts +256 -256
- package/src/browser/task-configuration-model.ts +101 -101
- package/src/browser/task-configurations.ts +508 -508
- package/src/browser/task-contribution.ts +266 -266
- package/src/browser/task-definition-registry.spec.ts +203 -203
- package/src/browser/task-definition-registry.ts +131 -131
- package/src/browser/task-frontend-contribution.ts +402 -402
- package/src/browser/task-frontend-module.ts +86 -86
- package/src/browser/task-name-resolver.ts +55 -55
- package/src/browser/task-node.ts +37 -37
- package/src/browser/task-preferences.ts +40 -40
- package/src/browser/task-problem-matcher-registry.ts +308 -308
- package/src/browser/task-problem-pattern-registry.ts +196 -196
- package/src/browser/task-schema-updater.ts +701 -701
- package/src/browser/task-service.ts +1164 -1164
- package/src/browser/task-source-resolver.ts +36 -36
- package/src/browser/task-templates.ts +168 -168
- package/src/browser/task-terminal-widget-manager.ts +224 -224
- package/src/browser/tasks-monaco-contribution.ts +27 -27
- package/src/common/index.ts +20 -20
- package/src/common/problem-matcher-protocol.ts +234 -234
- package/src/common/process/task-protocol.ts +97 -97
- package/src/common/task-common-module.ts +34 -34
- package/src/common/task-protocol.ts +317 -317
- package/src/common/task-util.ts +43 -43
- package/src/common/task-watcher.ts +78 -78
- package/src/node/custom/custom-task-runner-backend-module.ts +37 -37
- package/src/node/custom/custom-task-runner-contribution.ts +30 -30
- package/src/node/custom/custom-task-runner.ts +60 -60
- package/src/node/custom/custom-task.ts +73 -73
- package/src/node/index.ts +19 -19
- package/src/node/process/process-task-runner-backend-module.ts +37 -37
- package/src/node/process/process-task-runner-contribution.ts +31 -31
- package/src/node/process/process-task-runner.ts +371 -371
- package/src/node/process/process-task.spec.ts +30 -30
- package/src/node/process/process-task.ts +144 -144
- package/src/node/task-abstract-line-matcher.ts +312 -312
- package/src/node/task-backend-application-contribution.ts +36 -36
- package/src/node/task-backend-module.ts +57 -57
- package/src/node/task-line-matchers.ts +127 -127
- package/src/node/task-manager.ts +129 -129
- package/src/node/task-problem-collector.spec.ts +338 -338
- package/src/node/task-problem-collector.ts +62 -62
- package/src/node/task-runner-protocol.ts +33 -33
- package/src/node/task-runner.ts +96 -96
- package/src/node/task-server.slow-spec.ts +444 -444
- package/src/node/task-server.ts +263 -263
- package/src/node/task.ts +103 -103
- package/src/node/test/task-test-container.ts +63 -63
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2018 Red Hat, Inc. and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { injectable, inject, named } from '@theia/core/shared/inversify';
|
|
18
|
-
import { ContributionProvider } from '@theia/core';
|
|
19
|
-
import { BackendApplicationContribution } from '@theia/core/lib/node';
|
|
20
|
-
import { TaskRunnerContribution, TaskRunnerRegistry } from './task-runner';
|
|
21
|
-
|
|
22
|
-
@injectable()
|
|
23
|
-
export class TaskBackendApplicationContribution implements BackendApplicationContribution {
|
|
24
|
-
|
|
25
|
-
@inject(ContributionProvider) @named(TaskRunnerContribution)
|
|
26
|
-
protected readonly contributionProvider: ContributionProvider<TaskRunnerContribution>;
|
|
27
|
-
|
|
28
|
-
@inject(TaskRunnerRegistry)
|
|
29
|
-
protected readonly taskRunnerRegistry: TaskRunnerRegistry;
|
|
30
|
-
|
|
31
|
-
onStart(): void {
|
|
32
|
-
this.contributionProvider.getContributions().forEach(contrib =>
|
|
33
|
-
contrib.registerRunner(this.taskRunnerRegistry)
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2018 Red Hat, Inc. and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { injectable, inject, named } from '@theia/core/shared/inversify';
|
|
18
|
+
import { ContributionProvider } from '@theia/core';
|
|
19
|
+
import { BackendApplicationContribution } from '@theia/core/lib/node';
|
|
20
|
+
import { TaskRunnerContribution, TaskRunnerRegistry } from './task-runner';
|
|
21
|
+
|
|
22
|
+
@injectable()
|
|
23
|
+
export class TaskBackendApplicationContribution implements BackendApplicationContribution {
|
|
24
|
+
|
|
25
|
+
@inject(ContributionProvider) @named(TaskRunnerContribution)
|
|
26
|
+
protected readonly contributionProvider: ContributionProvider<TaskRunnerContribution>;
|
|
27
|
+
|
|
28
|
+
@inject(TaskRunnerRegistry)
|
|
29
|
+
protected readonly taskRunnerRegistry: TaskRunnerRegistry;
|
|
30
|
+
|
|
31
|
+
onStart(): void {
|
|
32
|
+
this.contributionProvider.getContributions().forEach(contrib =>
|
|
33
|
+
contrib.registerRunner(this.taskRunnerRegistry)
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2017 Ericsson and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
18
|
-
import { bindContributionProvider } from '@theia/core';
|
|
19
|
-
import { ConnectionHandler, RpcConnectionHandler } from '@theia/core/lib/common/messaging';
|
|
20
|
-
import { BackendApplicationContribution } from '@theia/core/lib/node';
|
|
21
|
-
import { bindProcessTaskRunnerModule } from './process/process-task-runner-backend-module';
|
|
22
|
-
import { bindCustomTaskRunnerModule } from './custom/custom-task-runner-backend-module';
|
|
23
|
-
import { TaskBackendApplicationContribution } from './task-backend-application-contribution';
|
|
24
|
-
import { TaskManager } from './task-manager';
|
|
25
|
-
import { TaskRunnerContribution, TaskRunnerRegistry } from './task-runner';
|
|
26
|
-
import { TaskServerImpl } from './task-server';
|
|
27
|
-
import { createCommonBindings } from '../common/task-common-module';
|
|
28
|
-
import { TaskClient, TaskServer, taskPath } from '../common';
|
|
29
|
-
|
|
30
|
-
export default new ContainerModule(bind => {
|
|
31
|
-
|
|
32
|
-
bind(TaskManager).toSelf().inSingletonScope();
|
|
33
|
-
bind(BackendApplicationContribution).toService(TaskManager);
|
|
34
|
-
|
|
35
|
-
bind(TaskServer).to(TaskServerImpl).inSingletonScope();
|
|
36
|
-
bind(ConnectionHandler).toDynamicValue(ctx =>
|
|
37
|
-
new RpcConnectionHandler<TaskClient>(taskPath, client => {
|
|
38
|
-
const taskServer = ctx.container.get<TaskServer>(TaskServer);
|
|
39
|
-
taskServer.setClient(client);
|
|
40
|
-
// when connection closes, cleanup that client of task-server
|
|
41
|
-
client.onDidCloseConnection(() => {
|
|
42
|
-
taskServer.disconnectClient(client);
|
|
43
|
-
});
|
|
44
|
-
return taskServer;
|
|
45
|
-
})
|
|
46
|
-
).inSingletonScope();
|
|
47
|
-
|
|
48
|
-
createCommonBindings(bind);
|
|
49
|
-
|
|
50
|
-
bind(TaskRunnerRegistry).toSelf().inSingletonScope();
|
|
51
|
-
bindContributionProvider(bind, TaskRunnerContribution);
|
|
52
|
-
bind(TaskBackendApplicationContribution).toSelf().inSingletonScope();
|
|
53
|
-
bind(BackendApplicationContribution).toService(TaskBackendApplicationContribution);
|
|
54
|
-
|
|
55
|
-
bindProcessTaskRunnerModule(bind);
|
|
56
|
-
bindCustomTaskRunnerModule(bind);
|
|
57
|
-
});
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2017 Ericsson and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
18
|
+
import { bindContributionProvider } from '@theia/core';
|
|
19
|
+
import { ConnectionHandler, RpcConnectionHandler } from '@theia/core/lib/common/messaging';
|
|
20
|
+
import { BackendApplicationContribution } from '@theia/core/lib/node';
|
|
21
|
+
import { bindProcessTaskRunnerModule } from './process/process-task-runner-backend-module';
|
|
22
|
+
import { bindCustomTaskRunnerModule } from './custom/custom-task-runner-backend-module';
|
|
23
|
+
import { TaskBackendApplicationContribution } from './task-backend-application-contribution';
|
|
24
|
+
import { TaskManager } from './task-manager';
|
|
25
|
+
import { TaskRunnerContribution, TaskRunnerRegistry } from './task-runner';
|
|
26
|
+
import { TaskServerImpl } from './task-server';
|
|
27
|
+
import { createCommonBindings } from '../common/task-common-module';
|
|
28
|
+
import { TaskClient, TaskServer, taskPath } from '../common';
|
|
29
|
+
|
|
30
|
+
export default new ContainerModule(bind => {
|
|
31
|
+
|
|
32
|
+
bind(TaskManager).toSelf().inSingletonScope();
|
|
33
|
+
bind(BackendApplicationContribution).toService(TaskManager);
|
|
34
|
+
|
|
35
|
+
bind(TaskServer).to(TaskServerImpl).inSingletonScope();
|
|
36
|
+
bind(ConnectionHandler).toDynamicValue(ctx =>
|
|
37
|
+
new RpcConnectionHandler<TaskClient>(taskPath, client => {
|
|
38
|
+
const taskServer = ctx.container.get<TaskServer>(TaskServer);
|
|
39
|
+
taskServer.setClient(client);
|
|
40
|
+
// when connection closes, cleanup that client of task-server
|
|
41
|
+
client.onDidCloseConnection(() => {
|
|
42
|
+
taskServer.disconnectClient(client);
|
|
43
|
+
});
|
|
44
|
+
return taskServer;
|
|
45
|
+
})
|
|
46
|
+
).inSingletonScope();
|
|
47
|
+
|
|
48
|
+
createCommonBindings(bind);
|
|
49
|
+
|
|
50
|
+
bind(TaskRunnerRegistry).toSelf().inSingletonScope();
|
|
51
|
+
bindContributionProvider(bind, TaskRunnerContribution);
|
|
52
|
+
bind(TaskBackendApplicationContribution).toSelf().inSingletonScope();
|
|
53
|
+
bind(BackendApplicationContribution).toService(TaskBackendApplicationContribution);
|
|
54
|
+
|
|
55
|
+
bindProcessTaskRunnerModule(bind);
|
|
56
|
+
bindCustomTaskRunnerModule(bind);
|
|
57
|
+
});
|
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2019 Ericsson and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { AbstractLineMatcher } from './task-abstract-line-matcher';
|
|
18
|
-
import { ProblemMatcher, ProblemMatch, WatchingPattern } from '../common/problem-matcher-protocol';
|
|
19
|
-
|
|
20
|
-
export class StartStopLineMatcher extends AbstractLineMatcher {
|
|
21
|
-
|
|
22
|
-
constructor(matcher: ProblemMatcher) {
|
|
23
|
-
super(matcher);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Finds the problem identified by this line matcher.
|
|
28
|
-
*
|
|
29
|
-
* @param line the line of text to find the problem from
|
|
30
|
-
* @return the identified problem. If the problem is not found, `undefined` is returned.
|
|
31
|
-
*/
|
|
32
|
-
match(line: string): ProblemMatch | undefined {
|
|
33
|
-
if (!this.activePattern) {
|
|
34
|
-
this.resetActivePatternIndex();
|
|
35
|
-
}
|
|
36
|
-
if (this.activePattern) {
|
|
37
|
-
const originalProblemData = Object.assign(this.getEmptyProblemData(), this.cachedProblemData);
|
|
38
|
-
const foundMatch = this.doOneLineMatch(line);
|
|
39
|
-
if (foundMatch) {
|
|
40
|
-
if (this.isUsingTheLastPattern()) {
|
|
41
|
-
const matchResult = this.getMarkerMatch(this.cachedProblemData);
|
|
42
|
-
if (this.isLastPatternLoop()) {
|
|
43
|
-
this.cachedProblemData = originalProblemData;
|
|
44
|
-
} else {
|
|
45
|
-
this.resetCachedProblemData();
|
|
46
|
-
this.resetActivePatternIndex();
|
|
47
|
-
}
|
|
48
|
-
return matchResult;
|
|
49
|
-
} else {
|
|
50
|
-
this.nextProblemPattern();
|
|
51
|
-
}
|
|
52
|
-
} else {
|
|
53
|
-
this.resetCachedProblemData();
|
|
54
|
-
if (this.activePatternIndex !== 0) { // if no match, use the first pattern to parse the same line
|
|
55
|
-
this.resetActivePatternIndex();
|
|
56
|
-
return this.match(line);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return undefined;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export class WatchModeLineMatcher extends StartStopLineMatcher {
|
|
65
|
-
|
|
66
|
-
private beginsPattern: WatchingPattern;
|
|
67
|
-
private endsPattern: WatchingPattern;
|
|
68
|
-
activeOnStart: boolean = false;
|
|
69
|
-
|
|
70
|
-
constructor(matcher: ProblemMatcher) {
|
|
71
|
-
super(matcher);
|
|
72
|
-
this.beginsPattern = matcher.watching!.beginsPattern;
|
|
73
|
-
this.endsPattern = matcher.watching!.endsPattern;
|
|
74
|
-
this.activeOnStart = matcher.watching!.activeOnStart === true;
|
|
75
|
-
this.resetActivePatternIndex(this.activeOnStart ? 0 : -1);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Finds the problem identified by this line matcher.
|
|
80
|
-
*
|
|
81
|
-
* @param line the line of text to find the problem from
|
|
82
|
-
* @return the identified problem. If the problem is not found, `undefined` is returned.
|
|
83
|
-
*/
|
|
84
|
-
override match(line: string): ProblemMatch | undefined {
|
|
85
|
-
if (this.activeOnStart) {
|
|
86
|
-
this.activeOnStart = false;
|
|
87
|
-
this.resetActivePatternIndex(0);
|
|
88
|
-
this.resetCachedProblemData();
|
|
89
|
-
return super.match(line);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (this.matchBegin(line)) {
|
|
93
|
-
const beginsPatternMatch = this.getMarkerMatch(this.cachedProblemData);
|
|
94
|
-
this.resetCachedProblemData();
|
|
95
|
-
return beginsPatternMatch;
|
|
96
|
-
}
|
|
97
|
-
if (this.matchEnd(line)) {
|
|
98
|
-
this.resetCachedProblemData();
|
|
99
|
-
return undefined;
|
|
100
|
-
}
|
|
101
|
-
if (this.activePattern) {
|
|
102
|
-
return super.match(line);
|
|
103
|
-
}
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
matchBegin(line: string): boolean {
|
|
108
|
-
const beginRegexp = new RegExp(this.beginsPattern.regexp);
|
|
109
|
-
const regexMatches = beginRegexp.exec(line);
|
|
110
|
-
if (regexMatches) {
|
|
111
|
-
this.fillProblemData(this.cachedProblemData, this.beginsPattern, regexMatches);
|
|
112
|
-
this.resetActivePatternIndex(0);
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
matchEnd(line: string): boolean {
|
|
119
|
-
const endRegexp = new RegExp(this.endsPattern.regexp);
|
|
120
|
-
const match = endRegexp.exec(line);
|
|
121
|
-
if (match) {
|
|
122
|
-
this.resetActivePatternIndex(-1);
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2019 Ericsson and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { AbstractLineMatcher } from './task-abstract-line-matcher';
|
|
18
|
+
import { ProblemMatcher, ProblemMatch, WatchingPattern } from '../common/problem-matcher-protocol';
|
|
19
|
+
|
|
20
|
+
export class StartStopLineMatcher extends AbstractLineMatcher {
|
|
21
|
+
|
|
22
|
+
constructor(matcher: ProblemMatcher) {
|
|
23
|
+
super(matcher);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Finds the problem identified by this line matcher.
|
|
28
|
+
*
|
|
29
|
+
* @param line the line of text to find the problem from
|
|
30
|
+
* @return the identified problem. If the problem is not found, `undefined` is returned.
|
|
31
|
+
*/
|
|
32
|
+
match(line: string): ProblemMatch | undefined {
|
|
33
|
+
if (!this.activePattern) {
|
|
34
|
+
this.resetActivePatternIndex();
|
|
35
|
+
}
|
|
36
|
+
if (this.activePattern) {
|
|
37
|
+
const originalProblemData = Object.assign(this.getEmptyProblemData(), this.cachedProblemData);
|
|
38
|
+
const foundMatch = this.doOneLineMatch(line);
|
|
39
|
+
if (foundMatch) {
|
|
40
|
+
if (this.isUsingTheLastPattern()) {
|
|
41
|
+
const matchResult = this.getMarkerMatch(this.cachedProblemData);
|
|
42
|
+
if (this.isLastPatternLoop()) {
|
|
43
|
+
this.cachedProblemData = originalProblemData;
|
|
44
|
+
} else {
|
|
45
|
+
this.resetCachedProblemData();
|
|
46
|
+
this.resetActivePatternIndex();
|
|
47
|
+
}
|
|
48
|
+
return matchResult;
|
|
49
|
+
} else {
|
|
50
|
+
this.nextProblemPattern();
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
this.resetCachedProblemData();
|
|
54
|
+
if (this.activePatternIndex !== 0) { // if no match, use the first pattern to parse the same line
|
|
55
|
+
this.resetActivePatternIndex();
|
|
56
|
+
return this.match(line);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export class WatchModeLineMatcher extends StartStopLineMatcher {
|
|
65
|
+
|
|
66
|
+
private beginsPattern: WatchingPattern;
|
|
67
|
+
private endsPattern: WatchingPattern;
|
|
68
|
+
activeOnStart: boolean = false;
|
|
69
|
+
|
|
70
|
+
constructor(matcher: ProblemMatcher) {
|
|
71
|
+
super(matcher);
|
|
72
|
+
this.beginsPattern = matcher.watching!.beginsPattern;
|
|
73
|
+
this.endsPattern = matcher.watching!.endsPattern;
|
|
74
|
+
this.activeOnStart = matcher.watching!.activeOnStart === true;
|
|
75
|
+
this.resetActivePatternIndex(this.activeOnStart ? 0 : -1);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Finds the problem identified by this line matcher.
|
|
80
|
+
*
|
|
81
|
+
* @param line the line of text to find the problem from
|
|
82
|
+
* @return the identified problem. If the problem is not found, `undefined` is returned.
|
|
83
|
+
*/
|
|
84
|
+
override match(line: string): ProblemMatch | undefined {
|
|
85
|
+
if (this.activeOnStart) {
|
|
86
|
+
this.activeOnStart = false;
|
|
87
|
+
this.resetActivePatternIndex(0);
|
|
88
|
+
this.resetCachedProblemData();
|
|
89
|
+
return super.match(line);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (this.matchBegin(line)) {
|
|
93
|
+
const beginsPatternMatch = this.getMarkerMatch(this.cachedProblemData);
|
|
94
|
+
this.resetCachedProblemData();
|
|
95
|
+
return beginsPatternMatch;
|
|
96
|
+
}
|
|
97
|
+
if (this.matchEnd(line)) {
|
|
98
|
+
this.resetCachedProblemData();
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
if (this.activePattern) {
|
|
102
|
+
return super.match(line);
|
|
103
|
+
}
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
matchBegin(line: string): boolean {
|
|
108
|
+
const beginRegexp = new RegExp(this.beginsPattern.regexp);
|
|
109
|
+
const regexMatches = beginRegexp.exec(line);
|
|
110
|
+
if (regexMatches) {
|
|
111
|
+
this.fillProblemData(this.cachedProblemData, this.beginsPattern, regexMatches);
|
|
112
|
+
this.resetActivePatternIndex(0);
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
matchEnd(line: string): boolean {
|
|
119
|
+
const endRegexp = new RegExp(this.endsPattern.regexp);
|
|
120
|
+
const match = endRegexp.exec(line);
|
|
121
|
+
if (match) {
|
|
122
|
+
this.resetActivePatternIndex(-1);
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
}
|