Skip to content

Refactor of copilotRemoteAgent#7520

Merged
osortega merged 1 commit intomainfrom
osortega/refactor-copilot-remote-agent
Aug 6, 2025
Merged

Refactor of copilotRemoteAgent#7520
osortega merged 1 commit intomainfrom
osortega/refactor-copilot-remote-agent

Conversation

@osortega
Copy link
Copy Markdown
Contributor

@osortega osortega commented Aug 6, 2025

Splitting and refactored copilotRemoteAgent

@osortega osortega merged commit 3872678 into main Aug 6, 2025
3 checks passed
@osortega osortega deleted the osortega/refactor-copilot-remote-agent branch August 6, 2025 22:19
@alexr00 alexr00 restored the osortega/refactor-copilot-remote-agent branch August 7, 2025 14:34
return false;
}

const eventTime = new Date(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There's a utility for getting the event time!

export function eventTime(event: Common.TimelineEvent): Date | undefined {
switch (event.event) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like this utility is going to be very useful throughout this file.

Comment on lines +163 to +169
if (event.event === EventType.Commented) {
const comment = event as CommentEvent;
return comment.body.includes('@copilot') || comment.body.includes(this.handler);
} else if (event.event === EventType.Reviewed) {
const review = event as ReviewEvent;
return review.body.includes('@copilot') || review.body.includes(this.handler);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This can be simplified:

Suggested change
if (event.event === EventType.Commented) {
const comment = event as CommentEvent;
return comment.body.includes('@copilot') || comment.body.includes(this.handler);
} else if (event.event === EventType.Reviewed) {
const review = event as ReviewEvent;
return review.body.includes('@copilot') || review.body.includes(this.handler);
}
if (event.event === EventType.Commented || event.event === EventType.Reviewed) {
return event.body.includes('@copilot') || event.body.includes(this.handler);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need for the casting even :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same change can apply in the other places that you access body.

@alexr00 alexr00 deleted the osortega/refactor-copilot-remote-agent branch August 8, 2025 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants