Skip to content

Commit a69e10e

Browse files
committed
icon backup
1 parent 4b43e3c commit a69e10e

3 files changed

Lines changed: 28 additions & 4 deletions

File tree

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
],
1414
"enabledApiProposals": [
1515
"terminalShellEnv",
16-
"terminalDataWriteEvent"
16+
"terminalDataWriteEvent",
17+
"taskExecutionTerminal"
18+
1719
],
1820
"capabilities": {
1921
"untrustedWorkspaces": {

src/features/terminal/utils.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as path from 'path';
2-
import { Disposable, env, Terminal, TerminalOptions, Uri } from 'vscode';
2+
import { Disposable, env, tasks, Terminal, TerminalOptions, Uri } from 'vscode';
33
import { PythonEnvironment, PythonProject, PythonProjectEnvironmentApi, PythonProjectGetterApi } from '../../api';
44
import { timeout } from '../../common/utils/asyncUtils';
55
import { createSimpleDebounce } from '../../common/utils/debounce';
@@ -128,9 +128,16 @@ function detectsCommonPromptPattern(terminalData: string): boolean {
128128
return false;
129129
}
130130

131+
/**
132+
* Check if a terminal is associated with a running task.
133+
* Uses tasks.taskExecutions API to check if the terminal is associated with a task.
134+
* See: https://github.com/microsoft/vscode/issues/234440
135+
*
136+
* @param terminal The terminal to check.
137+
* @returns True if the terminal is a task terminal, false otherwise.
138+
*/
131139
export function isTaskTerminal(terminal: Terminal): boolean {
132-
// TODO: Need API for core for this https://github.com/microsoft/vscode/issues/234440
133-
return terminal.name.toLowerCase().includes('task');
140+
return tasks.taskExecutions.some((execution) => execution.terminal === terminal);
134141
}
135142

136143
export function getTerminalCwd(terminal: Terminal): string | undefined {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
// #234440
7+
declare module 'vscode' {
8+
9+
export interface TaskExecution {
10+
/**
11+
* The terminal associated with this task execution, if any.
12+
*/
13+
terminal?: Terminal;
14+
}
15+
}

0 commit comments

Comments
 (0)