@@ -21,6 +21,8 @@ import { FolderOperation } from "../WorkspaceContext";
2121import contextKeys from "../contextKeys" ;
2222import { Dependency , ResolvedDependency , Target } from "../SwiftPackage" ;
2323import { FolderContext } from "../FolderContext" ;
24+ import { getPlatformConfig , resolveTaskCwd } from "../utilities/tasks" ;
25+ import { SwiftTask , TaskPlatformSpecificConfig } from "../tasks/SwiftTaskProvider" ;
2426
2527const LOADING_ICON = "loading~spin" ;
2628/**
@@ -573,17 +575,20 @@ export class ProjectPanelProvider implements vscode.TreeDataProvider<TreeNode> {
573575 }
574576
575577 private async tasks ( folderContext : FolderContext ) : Promise < TaskNode [ ] > {
576- const tasks = await vscode . tasks . fetchTasks ( ) ;
578+ const tasks = await vscode . tasks . fetchTasks ( { type : "swift" } ) ;
577579
578580 return (
579581 tasks
580582 // Plugin tasks are shown under the Commands header
581- . filter (
582- task =>
583- ( ! task . definition . cwd ||
584- task . definition . cwd === folderContext . folder . fsPath ) &&
585- task . source !== "swift-plugin"
586- )
583+ . filter ( task => {
584+ const platform : TaskPlatformSpecificConfig | undefined =
585+ getPlatformConfig ( task ) ;
586+ return (
587+ ! task . definition . cwd ||
588+ resolveTaskCwd ( task , platform ?. cwd ?? task . definition . cwd ) ===
589+ folderContext . folder . fsPath
590+ ) ;
591+ } )
587592 . map (
588593 ( task , i ) =>
589594 new TaskNode (
@@ -631,7 +636,7 @@ export class ProjectPanelProvider implements vscode.TreeDataProvider<TreeNode> {
631636 * This is a workaround for the lack of an event when tasks are added or removed.
632637 */
633638class TaskPoller implements vscode . Disposable {
634- private previousTasks : vscode . Task [ ] = [ ] ;
639+ private previousTasks : SwiftTask [ ] = [ ] ;
635640 private timeout ?: NodeJS . Timeout ;
636641 private static POLL_INTERVAL = 5000 ;
637642
@@ -641,15 +646,13 @@ class TaskPoller implements vscode.Disposable {
641646
642647 private async pollTasks ( ) {
643648 try {
644- const tasks = await vscode . tasks . fetchTasks ( ) ;
649+ const tasks = ( await vscode . tasks . fetchTasks ( { type : "swift" } ) ) as SwiftTask [ ] ;
645650 const tasksChanged =
646651 tasks . length !== this . previousTasks . length ||
647652 tasks . some ( ( task , i ) => {
648653 const prev = this . previousTasks [ i ] ;
649- // eslint-disable-next-line @typescript-eslint/no-explicit-any
650- const c1 = ( task . execution as any ) . command ;
651- // eslint-disable-next-line @typescript-eslint/no-explicit-any
652- const c2 = ( prev . execution as any ) . command ;
654+ const c1 = task . execution . command ;
655+ const c2 = prev . execution . command ;
653656 return (
654657 ! prev ||
655658 task . name !== prev . name ||
0 commit comments