Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TaskService

Hierarchy

  • TaskService

Implements

Index

Properties

Protected Readonly app

Protected cachedRecentTasks

cachedRecentTasks: TaskConfiguration[] = []

Protected Readonly commands

commands: CommandService

Protected Readonly editorManager

editorManager: EditorManager

Protected Readonly labelProvider

labelProvider: LabelProvider

Protected lastTask

lastTask: { scope: TaskConfigurationScope; source: string; taskLabel: string } | undefined = undefined

The last executed task.

Protected Readonly logger

logger: ILogger

Protected Readonly messageService

messageService: MessageService

Protected monacoWorkspace

monacoWorkspace: MonacoWorkspace

Protected Readonly openerService

openerService: OpenerService

Protected Readonly problemManager

problemManager: ProblemManager

Protected Readonly problemMatcherRegistry

problemMatcherRegistry: ProblemMatcherRegistry

Protected Readonly providedTaskConfigurations

providedTaskConfigurations: ProvidedTaskConfigurations

Protected Readonly quickPickService

quickPickService: QuickPickService

Protected runningTasks

runningTasks: Map<number, { exitCode: Deferred<number | undefined>; isBackgroundTaskEnded: Deferred<boolean | undefined>; terminateSignal: Deferred<string | undefined> }> = new Map<number, {exitCode: Deferred<number | undefined>,terminateSignal: Deferred<string | undefined>,isBackgroundTaskEnded: Deferred<boolean | undefined>}>()

Protected Readonly shell

Protected Readonly shellTerminalServer

shellTerminalServer: ShellTerminalServerProxy

Protected Readonly taskConfigurationManager

taskConfigurationManager: TaskConfigurationManager

Protected Readonly taskConfigurations

taskConfigurations: TaskConfigurations

Protected Readonly taskDefinitionRegistry

taskDefinitionRegistry: TaskDefinitionRegistry

Protected Readonly taskNameResolver

taskNameResolver: TaskNameResolver

Protected Readonly taskResolverRegistry

taskResolverRegistry: TaskResolverRegistry

Protected Readonly taskSchemaUpdater

taskSchemaUpdater: TaskSchemaUpdater

Protected Readonly taskServer

taskServer: TaskServer

Protected Readonly taskSourceResolver

taskSourceResolver: TaskSourceResolver

Protected taskStartingLock

taskStartingLock: Mutex = new Mutex()

Protected Readonly taskTerminalWidgetManager

taskTerminalWidgetManager: TaskTerminalWidgetManager

Protected Readonly taskWatcher

taskWatcher: TaskWatcher

Protected Readonly terminalService

terminalService: TerminalService

Protected Readonly variableResolverService

variableResolverService: VariableResolverService

Protected Readonly widgetManager

widgetManager: WidgetManager

Protected Readonly workspaceService

workspaceService: WorkspaceService

Accessors

recentTasks

Methods

addRecentTasks

attach

  • attach(terminalId: number, taskInfo: TaskInfo): Promise<number | void>

clearRecentTasks

  • clearRecentTasks(): void

configure

createChildTaskNode

customExecutionComplete

  • customExecutionComplete(id: number, exitCode: number | undefined): Promise<void>

detectDirectedAcyclicGraph

Protected doRunTask

getConfiguredTasks

Protected getContext

  • getContext(): string | undefined

Protected getCustomizeProblemMatcherItems

getDependentTask

  • Gets task configuration by task label or by a JSON object which represents a task identifier

    Parameters

    • taskIdentifier: string | TaskIdentifier

      The task label (string) or a JSON object which represents a TaskIdentifier (e.g. {"type":"npm", "script":"script1"})

    • tasks: TaskConfiguration[]

      an array of the task configurations

    Returns TaskConfiguration

    the correct TaskConfiguration object which matches the taskIdentifier

getExitCode

  • getExitCode(id: number): Promise<number | undefined>

getLastTask

getProvidedTask

  • Returns a task configuration provided by an extension by task source, scope and label. If there are no task configuration, returns undefined.

    Parameters

    • token: number

      The cache token for the user interaction in progress

    • source: string

      The source for configured tasks

    • label: string

      The label of the task to find

    • scope: TaskConfigurationScope

      The task scope to look in

    Returns Promise<TaskConfiguration | undefined>

getProvidedTasks

getRegisteredTaskTypes

  • getRegisteredTaskTypes(): Promise<string[]>

getRunningTasks

  • getRunningTasks(): Promise<TaskInfo[]>

getTaskByTaskIdentifier

  • Gets the matched task from an array of task configurations by TaskIdentifier. In case that more than one task configuration matches, we returns the first one.

    Parameters

    • taskIdentifier: TaskIdentifier

      The task label (string) or a JSON object which represents a TaskIdentifier (e.g. {"type":"npm", "script":"script1"})

    • tasks: TaskConfiguration[]

      An array of task configurations.

    Returns TaskConfiguration

    The correct TaskConfiguration object which matches the taskIdentifier.

Protected getTaskCustomization

Protected getTaskIdentifier

getTasks

Protected getTerminalWidgetId

  • getTerminalWidgetId(terminalId: number): string | undefined

getTerminateSignal

  • getTerminateSignal(id: number): Promise<string | undefined>

Protected getWorkspaceTasks

Protected init

  • init(): void

isBackgroundTaskEnded

  • isBackgroundTaskEnded(id: number): Promise<boolean | undefined>

Protected isEventForThisClient

  • isEventForThisClient(context: string | undefined): boolean

kill

  • kill(id: number): Promise<void>

openUserTasks

  • openUserTasks(): Promise<void>

Protected removeProblemMarkers

Protected resolveProblemMatchers

restartTask

run

  • Runs a task, by the source and label of the task configuration. It looks for configured and detected tasks.

    Parameters

    • token: number

      The cache token for the user interaction in progress

    • source: string

      The source for configured tasks

    • taskLabel: string

      The label to look for

    • scope: TaskConfigurationScope

      The scope where to look for tasks

    Returns Promise<TaskInfo | undefined>

runCompoundTask

runConfiguredTask

  • Runs a task, by task configuration label. Note, it looks for a task configured in tasks.json only.

    Parameters

    • token: number

      The cache token for the user interaction in progress

    • scope: TaskConfigurationScope

      The scope where to look for tasks

    • taskLabel: string

      the label to look for

    Returns Promise<void>

runLastTask

  • runLastTask(token: number): Promise<TaskInfo | undefined>

Protected runResolvedTask

runSelectedText

  • runSelectedText(): Promise<void>

runTask

runTaskByLabel

  • runTaskByLabel(token: number, taskLabel: string): Promise<TaskInfo | undefined>
  • Runs the first task with the given label.

    Parameters

    • token: number

      The cache token for the user interaction in progress

    • taskLabel: string

      The label of the task to be executed

    Returns Promise<TaskInfo | undefined>

runTasksGraph

runWorkspaceTask

  • runWorkspaceTask(token: number, workspaceFolderUri: string | undefined, taskIdentifier: string | TaskIdentifier): Promise<TaskInfo | undefined>
  • Runs a task identified by the given identifier, but only if found in the given workspace folder

    Parameters

    • token: number

      The cache token for the user interaction in progress

    • workspaceFolderUri: string | undefined

      The folder to restrict the search to

    • taskIdentifier: string | TaskIdentifier

      The identifier to look for

    Returns Promise<TaskInfo | undefined>

startUserAction

  • startUserAction(): number
  • Client should call this method to indicate that a new user-level action related to tasks has been started, like invoking "Run Task..." This method returns a token that can be used with various methods in this service. As long as a client uses the same token, task providers will only asked once to contribute tasks and the set of tasks will be cached. Each time the a new token is used, the cache of contributed tasks is cleared.

    Returns number

    a token to be used for task-related actions

taskConfigurationChanged

  • taskConfigurationChanged(event: string[]): void

terminateTask

  • terminateTask(activeTaskInfo: TaskInfo): Promise<void>

updateTaskConfiguration

  • updateTaskConfiguration(token: number, task: TaskConfiguration, update: {}): Promise<void>
  • Updates the task configuration in the tasks.json. The task config, together with updates, will be written into the tasks.json if it is not found in the file.

    Parameters

    • token: number

      The cache token for the user interaction in progress

    • task: TaskConfiguration

      task that the updates will be applied to

    • update: {}

      the updates to be applied

      • [name: string]: any

    Returns Promise<void>