Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed Feb 7, 2025
1 parent 4c41dad commit 6ebd908
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2956,6 +2956,10 @@ export abstract class AbstractTaskService extends Disposable implements ITaskSer
this._reRunTaskCommand();
}

restart(task: Task): Promise<void> {
return this._restart(task);
}

private _reRunTaskCommand(): void {

ProblemMatcherRegistry.onReady().then(() => {
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/contrib/tasks/common/taskService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export interface ITaskService {
tasks(filter?: ITaskFilter): Promise<Task[]>;
getTaskForTerminal(instanceId: number): Promise<Task | undefined>;
rerun(): void;
restart(task: Task): Promise<void>;
/**
* Gets tasks currently known to the task system. Unlike {@link tasks},
* this does not activate extensions or prompt for workspace trust.
Expand Down
8 changes: 1 addition & 7 deletions src/vs/workbench/contrib/terminal/browser/terminalActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1445,16 +1445,10 @@ export function registerTerminalActions() {
const terminalService = accessor.get(ITerminalService);
const taskSystem = accessor.get(ITaskService);
const instance = args as ITerminalInstance ?? terminalService.activeInstance;

if (instance) {
const task = await taskSystem.getTaskForTerminal(instance.instanceId);
if (task) {
// send ctrl+D to the terminal to kill the demon
await instance.sendText('\x04', true);
const result = await taskSystem.terminate(task);
if (result.success) {
await taskSystem.run(task);
}
await taskSystem.restart(task);
} else {
// This is a single run task, just rerun it
taskSystem.rerun();
Expand Down

0 comments on commit 6ebd908

Please sign in to comment.