Skip to content

fix: make sure run-task callback from new graph still works #2646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,8 @@ abstract class NxGraphBrowserBase(protected val project: Project) : Disposable {
return true
}
"run-task" -> {
event.payload?.taskId?.also {
NxTaskExecutionManager.getInstance(project).execute(it)
}
val task = event.payload?.taskName ?: event.payload?.taskId
task?.also { NxTaskExecutionManager.getInstance(project).execute(it) }
return true
}
"run-help" -> {
Expand Down Expand Up @@ -475,6 +474,7 @@ data class NxGraphInteractionPayload(
val targetName: String? = null,
val url: String? = null,
val taskId: String? = null,
val taskName: String? = null,
val targetConfigString: String? = null,
val helpCommand: String? = null,
val helpCwd: String? = null,
Expand Down
10 changes: 5 additions & 5 deletions libs/vscode/graph-base/src/handle-graph-interaction-event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function handleGraphInteractionEventBase(event: {

commands.executeCommand(
'vscode.open',
Uri.file(join(workspacePath, event.payload.url))
Uri.file(join(workspacePath, event.payload.url)),
);
return true;
}
Expand All @@ -39,7 +39,7 @@ export async function handleGraphInteractionEventBase(event: {
});
CliTaskProvider.instance.executeTask({
command: 'run',
positional: event.payload.taskId,
positional: event.payload.taskName ?? event.payload.taskId,
flags: [],
});
return true;
Expand All @@ -57,7 +57,7 @@ export async function handleGraphInteractionEventBase(event: {
if (!project) return;
importNxPackagePath<typeof import('nx/src/devkit-exports')>(
workspacePath,
'src/devkit-exports'
'src/devkit-exports',
).then(({ detectPackageManager }) => {
const pkgManager = detectPackageManager(workspacePath);
tasks.executeTask(
Expand All @@ -77,8 +77,8 @@ export async function handleGraphInteractionEventBase(event: {
env: {
NX_CONSOLE: 'true',
},
})
)
}),
),
);
});
});
Expand Down
Loading