-
Notifications
You must be signed in to change notification settings - Fork 79
fix: delay request if process not ready yet #340
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,12 @@ class SocketCustomLintServerToClientChannel { | |
final CustomLintWorkspace _workspace; | ||
|
||
AnalysisSetContextRootsParams _contextRoots; | ||
bool _initialed = false; | ||
|
||
/// Initial state | ||
/// | ||
/// Returns `true` if requested `analysis.setContextRoots` | ||
bool get initialed => _initialed; | ||
|
||
late final Stream<CustomLintMessage> _messages = _channel.messages | ||
.map((e) => e! as Map<String, Object?>) | ||
|
@@ -127,6 +133,7 @@ class SocketCustomLintServerToClientChannel { | |
sendAnalyzerPluginRequest(_version.toRequest(const Uuid().v4())), | ||
sendAnalyzerPluginRequest(_contextRoots.toRequest(const Uuid().v4())), | ||
]); | ||
_initialed = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a fan of this. It's a bit of a duplicate compared to fields like _processFuture. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. _procesFuture only tells whether the process has run or not (even if it has errors), we need a flag to know that the process has run without errors and the The logic I'm going for is that all other requests should be sent after anyway it's a typo, Windows can't write test, I'm installing Linux and will ping you when fixed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All requests naturally await that the process is initialised. That logic is redundant, as the communication channel already handles it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it was sent but in the wrong order, I am sorting them (instead of drop them) in the correct order because any AnalyzerPluginRequest must be sent after before (wrong order): after (setContextRoots must be first): There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Requests are ensured to be sent in the right order. All requests wait for the client to be fully initialized. |
||
} | ||
|
||
/// Updates the context roots on the client | ||
|
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.
What's the point of all of this logic if we're unawaiting the requests anyway?
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.
This logic is same
_requestSubscription
, we just need replay request after delay, so no need to await or handle response. I also added test for this MR