-
Notifications
You must be signed in to change notification settings - Fork 20
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 and cleanup GLSPContribution API #146
Conversation
0564786
to
ad1346f
Compare
Drop dependency to sprotty-theia , move dependent code in-repo and adapt existing code base. Code that is adapted from the orginal sprotty-theia repository is proplery marked in the copyright notice and with an inline comment Depends on: #146 Fixes eclipse-glsp/glsp#847
Drop dependency to sprotty-theia , move dependent code in-repo and adapt existing code base. Code that is adapted from the orginal sprotty-theia repository is proplery marked in the copyright notice and with an inline comment Depends on: #146 Fixes eclipse-glsp/glsp#847
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.
Changes look good to me and seem to work well. I have a few questions regarding code which I'd like to clarify first.
if (data) { | ||
const message = data.toString(); | ||
protected override processLogInfo(line: string): void { | ||
if (line) { |
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.
Can line
be undefined? If so, the method signature should actually show this. If not then I do not see any advantage of checking for empty string here if we check for startsWith
anyway.
const message = data.toString(); | ||
protected override processLogInfo(line: string): void { | ||
if (line) { | ||
const message = line.toString(); |
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.
Unnecessary if line really can be only of type string and not of type Buffer
as available before.
if (data) { | ||
console.error(`${this.id}: ${data}`); | ||
protected processLogError(line: string): void { | ||
if (line) { |
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.
Do we do this to filter empty lines or because line can be undefined?
* @returns the corresponding `GLSPClient` or `undefined` if no client is configured for the given type | ||
*/ | ||
async getGLSPClient(contributionId: string): Promise<GLSPClient | undefined> { | ||
return this.getGLSPClientContribution(contributionId)?.glspClient ?? undefined; |
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.
return this.getGLSPClientContribution(contributionId)?.glspClient ?? undefined; | |
return this.getGLSPClientContribution(contributionId)?.glspClient; |
@@ -83,84 +109,58 @@ export abstract class BaseGLSPClientContribution implements GLSPClientContributi | |||
}); | |||
} | |||
|
|||
waitForActivation(app: FrontendApplication): Promise<any> { | |||
const activationPromises: Promise<any>[] = []; |
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 really like that we no longer have a default activation condition! We just need to make sure we properly document it as it definitely may break some assumptions.
|
||
activate(): Disposable { | ||
if (this.toDeactivate.disposed) { | ||
activate(app: FrontendApplication): void { |
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.
Should activate
maybe return a promise? Seems like we should have one at hand and it might be useful for some cases.
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.
=> MaybePromise
} | ||
|
||
deactivate(_app: FrontendApplication): void { | ||
this.toDeactivate.dispose(); | ||
this.toDispose.dispose(); |
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.
Should that call dispose
or the other way around?
}) | ||
]); | ||
} | ||
}, | ||
{ reconnecting: false } | ||
{ reconnecting: true } |
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.
Do we properly handle reconnection or does that work out of the box? Or does it not matter at all?
- Refactor `GLSPCLientProvider` and reuse it in `BaseGLSPTheiaConnector` - Make GLSPContributions disposable - Cleanup redundant session concept in `GLSPBackendContribution` - Cleanup & refactor`GLSPClientContribution` API. - Cleanup & refactor`GLSPSocketServerContribution` API - Remove remains from @theia/languages - Simplify client initialization by using Theia's Deferred concept. Fixes eclipse-glsp/glsp#848
ad1346f
to
18351b7
Compare
Thanks for the fast review, I have added a commit that should address the open issues |
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.
LGTM!
Drop dependency to sprotty-theia , move dependent code in-repo and adapt existing code base. Code that is adapted from the orginal sprotty-theia repository is proplery marked in the copyright notice and with an inline comment Depends on: #146 Fixes eclipse-glsp/glsp#847
Drop dependency to sprotty-theia , move dependent code in-repo and adapt existing code base. Code that is adapted from the orginal sprotty-theia repository is proplery marked in the copyright notice and with an inline comment Depends on: #146 Fixes eclipse-glsp/glsp#847
GLSPCLientProvider
and reuse it inBaseGLSPTheiaConnector
GLSPBackendContribution
GLSPClientContribution
API.GLSPSocketServerContribution
APIFixes eclipse-glsp/glsp#848