-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Refactor/rename messaging contribution push param #10996
Refactor/rename messaging contribution push param #10996
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution 👍
In order to accept your changes please be sure to sure to sign the eclipse contributor agreement (eca) with the same email as your authorship.
I'm not sure I fully understand the reasons for the change, it is only updating the variable name in the callback, uses of MessagingContribution.push
still use channel
(verified with find all references
).
The original |
I believe
theia/packages/core/src/electron-main/messaging/electron-messaging-contribution.ts Line 46 in 3893fde
|
so, if this is meaningful: push(spec: string, callback: (params: MessagingService.PathParams, connection: T) => void): void {
const route = new Route(spec);
// here is the change, or you can look at the lastest changes.
this.handlers.push((path, channel: T) => {
const params = route.match(path);
if (!params) {
return false;
}
callback(params, channel);
return route.reverse(params);
});
} |
@@ -211,7 +211,7 @@ export namespace MessagingContribution { | |||
|
|||
push(spec: string, callback: (params: MessagingService.PathParams, connection: T) => void): void { | |||
const route = new Route(spec); | |||
this.handlers.push((path, channel) => { | |||
this.handlers.push((path, channel: T) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the value in this change?
We can already infer the type from handlers
:
protected readonly handlers: ((path: string, connection: T) => string | false)[] = [];
and the editor gives us hover information that channel
is of type T
.
What exactly is the change attempting to achieve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, please ignore this pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem! If there are improvements or features you'd like to work on please don't hesitate to contribute and we'd be happy to review them :)
What it does
Rename message-contirbution.ts(packages/core/src/node/messaging/messaging-contribution.ts) ConnectionHandlers.push param, which is changing channel to socket.
How to test
No need to test.
Review checklist
Reminder for reviewers