Skip to content

Commit d150bcb

Browse files
pqCommit Queue
authored andcommitted
[das] legacy server support for analytics checking
Fixes: #60853 Change-Id: I3a14c209482b47dc8228c678793e23cf91295fd6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432780 Commit-Queue: Phil Quitslund <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent f7068a4 commit d150bcb

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

pkg/analysis_server/lib/src/analysis_server.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,20 @@ abstract class AnalysisServer {
520520
);
521521
}
522522

523+
/// Display a message that will allow us to enable analytics on the next run.
524+
void checkAnalytics() {
525+
var unifiedAnalytics = analyticsManager.analytics;
526+
var prompt = userPromptSender;
527+
if (!unifiedAnalytics.shouldShowMessage || prompt == null) {
528+
return;
529+
}
530+
531+
unawaited(
532+
prompt(MessageType.info, unifiedAnalytics.getConsentMessage, ['Ok']),
533+
);
534+
unifiedAnalytics.clientShowedMessage();
535+
}
536+
523537
/// Checks that all [sessions] are still consistent, throwing
524538
/// [InconsistentAnalysisException] if not.
525539
void checkConsistency(List<AnalysisSessionImpl> sessions) {

pkg/analysis_server/lib/src/handler/legacy/server_set_client_capabilities.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class ServerSetClientCapabilitiesHandler extends LegacyHandler {
2626
request,
2727
clientUriConverter: server.uriConverter,
2828
);
29+
30+
server.checkAnalytics();
2931
} on RequestFailure catch (exception) {
3032
sendResponse(exception.response);
3133
return;

pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ class LspAnalysisServer extends AnalysisServer {
419419
performanceAfterStartup = ServerPerformance();
420420
performance = performanceAfterStartup!;
421421

422-
_checkAnalytics();
422+
checkAnalytics();
423423
enableSurveys();
424424

425425
// Notify the client of any issues parsing experimental capabilities.
@@ -1073,21 +1073,6 @@ class LspAnalysisServer extends AnalysisServer {
10731073
notifyFlutterWidgetDescriptions(path);
10741074
}
10751075

1076-
/// Display a message that will allow us to enable analytics on the next run.
1077-
void _checkAnalytics() {
1078-
// TODO(dantup): This code should move to base server.
1079-
var unifiedAnalytics = analyticsManager.analytics;
1080-
var prompt = userPromptSender;
1081-
if (!unifiedAnalytics.shouldShowMessage || prompt == null) {
1082-
return;
1083-
}
1084-
1085-
unawaited(
1086-
prompt(MessageType.info, unifiedAnalytics.getConsentMessage, ['Ok']),
1087-
);
1088-
unifiedAnalytics.clientShowedMessage();
1089-
}
1090-
10911076
/// Computes analysis roots for a set of open files.
10921077
///
10931078
/// This is used when there are no workspace folders open directly.

0 commit comments

Comments
 (0)