-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To align the task list display in theia with that of vscode, we need to differentiate 3 things: - the task type - where the task comes from, and - where the task is supposed to be run from This change adds an optional '_scope' to the TaskConfiguration interface. Together with 'type' and '_source', we have enough number of properties to hold the information from vscode extensions. Signed-off-by: elaihau <liang.huang@ericsson.com>
- Loading branch information
elaihau
committed
Feb 28, 2019
1 parent
71ad540
commit f53de3a
Showing
13 changed files
with
141 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2019 Ericsson and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
import { inject, injectable } from 'inversify'; | ||
import { TaskConfiguration } from '../common/task-protocol'; | ||
import { TaskProviderRegistry } from './task-contribution'; | ||
|
||
@injectable() | ||
export class ProvidedTaskConfigurations { | ||
|
||
/** | ||
* Map of source (name of extension, or path of root folder that the task config comes from) and `task config map`. | ||
* For the inner map (i.e., `task config map`), the key is task label and value TaskConfiguration | ||
*/ | ||
protected tasksMap = new Map<string, Map<string, TaskConfiguration>>(); | ||
|
||
@inject(TaskProviderRegistry) | ||
protected readonly taskProviderRegistry: TaskProviderRegistry; | ||
|
||
/** returns a list of provided tasks */ | ||
async getTasks(): Promise<TaskConfiguration[]> { | ||
const providedTasks: TaskConfiguration[] = []; | ||
const providers = this.taskProviderRegistry.getProviders(); | ||
for (const provider of providers) { | ||
providedTasks.push(...await provider.provideTasks()); | ||
} | ||
this.cacheTasks(providedTasks); | ||
return providedTasks; | ||
} | ||
|
||
/** returns the task configuration for a given source and label or undefined if none */ | ||
getTask(source: string, taskLabel: string): TaskConfiguration | undefined { | ||
const labelConfigMap = this.tasksMap.get(source); | ||
if (labelConfigMap) { | ||
return labelConfigMap.get(taskLabel); | ||
} | ||
} | ||
|
||
protected cacheTasks(tasks: TaskConfiguration[]): void { | ||
for (const task of tasks) { | ||
const label = task.label; | ||
const source = task._source; | ||
if (this.tasksMap.has(source)) { | ||
this.tasksMap.get(source)!.set(label, task); | ||
} else { | ||
const labelTaskMap = new Map<string, TaskConfiguration>(); | ||
labelTaskMap.set(label, task); | ||
this.tasksMap.set(source, labelTaskMap); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters