Skip to content
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

tasks: use a type union for ITaskEvent #192314

Merged
merged 1 commit into from
Sep 6, 2023
Merged

Conversation

connor4312
Copy link
Member

@connor4312 connor4312 commented Sep 6, 2023

When fixing a bug in debug I noticed that all properties of the
ITaskEvent were optional, so I had to go into task code to figure out
what types I could use.

This PR refactors the types so ITaskEvent is a union type that provides
as much information as possible about the presence of properties.

I tested this on some projects but am not sure if there's a repo/project
to test out the full gamut of task functionality. But there should be
no (barring one, see comment) functional change.

When fixing a bug in tests I noticed that all properties of the
ITaskEvent were optional, so I had to go into task code to figure out
what types I could use.

This PR refactors the types so ITaskEvent is a union type that provides
as much information as possible about the presence of properties.

I tested this on some projects but am not sure if there's a repo/project
to test out the full gamut of task functionality. But there should be
no (barring once, see comment) functional change.
@connor4312 connor4312 self-assigned this Sep 6, 2023
@connor4312 connor4312 enabled auto-merge (squash) September 6, 2023 17:24
if (reconnectedTerminal) {
if ('command' in task && task.command.presentation) {
reconnectedTerminal.waitOnExit = getWaitOnExitValue(task.command.presentation, task.configurationProperties);
}
reconnectedTerminal.onDisposed((terminal) => this._fireTaskEvent({ kind: TaskEventKind.Terminated, exitReason: terminal.exitReason, taskId: task.getRecentlyUsedKey() }));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the one functional change. I'm pretty sure taskId: task.getRecentlyUsedKey() was a bug or at least a hack; the task ID and recently used key are not interchangable and other places where Terminated is fired do not use the recently used key in place of ID.

@VSCodeTriageBot VSCodeTriageBot added this to the September 2023 milestone Sep 6, 2023
Copy link
Contributor

@meganrogge meganrogge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@connor4312 connor4312 merged commit 4747d36 into main Sep 6, 2023
7 checks passed
@connor4312 connor4312 deleted the connor4312/task-event-types branch September 6, 2023 18:31
@github-actions github-actions bot locked and limited conversation to collaborators Oct 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants