Skip to content

Commit cbb3237

Browse files
srawlinsCommit Queue
authored andcommitted
DAS plugins: fix bad parsing of unsupported requests
I noticed only recently that every time I create a new source file in a package which is being analyzed with analyzer plugins, I get an "exception," a toast popup in the IDE. It turns out I goofed in da1d59c and totally busted the switch statement. The request types above ANALYSIS_REQUEST_HANDLE_WATCH_EVENTS still flow into it's body. Ouch. Change-Id: I3ba9fecfb9c3a1e8585e472b09fa0b2f78ba18df Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449145 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent b6b20c8 commit cbb3237

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

pkg/analysis_server_plugin/lib/src/plugin_server.dart

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,6 @@ class PluginServer {
542542
Future<Response?> _getResponse(Request request, int requestTime) async {
543543
ResponseResult? result;
544544
switch (request.method) {
545-
case protocol.ANALYSIS_REQUEST_GET_NAVIGATION:
546545
case protocol.ANALYSIS_REQUEST_HANDLE_WATCH_EVENTS:
547546
var params = protocol.AnalysisHandleWatchEventsParams.fromRequest(
548547
request,
@@ -556,28 +555,21 @@ class PluginServer {
556555
result = await _handleAnalysisSetContextRoots(params);
557556

558557
case protocol.ANALYSIS_REQUEST_SET_PRIORITY_FILES:
559-
case protocol.ANALYSIS_REQUEST_SET_SUBSCRIPTIONS:
558+
// TODO(srawlins): Support!
559+
result = null;
560+
560561
case protocol.ANALYSIS_REQUEST_UPDATE_CONTENT:
561562
var params = protocol.AnalysisUpdateContentParams.fromRequest(request);
562563
result = await _handleAnalysisUpdateContent(params);
563564

564-
case protocol.COMPLETION_REQUEST_GET_SUGGESTIONS:
565-
result = null;
566-
567565
case protocol.EDIT_REQUEST_GET_ASSISTS:
568566
var params = protocol.EditGetAssistsParams.fromRequest(request);
569567
result = await handleEditGetAssists(params);
570568

571-
case protocol.EDIT_REQUEST_GET_AVAILABLE_REFACTORINGS:
572-
result = null;
573-
574569
case protocol.EDIT_REQUEST_GET_FIXES:
575570
var params = protocol.EditGetFixesParams.fromRequest(request);
576571
result = await handleEditGetFixes(params);
577572

578-
case protocol.EDIT_REQUEST_GET_REFACTORING:
579-
result = null;
580-
581573
case protocol.PLUGIN_REQUEST_DETAILS:
582574
var details = <protocol.PluginDetails>[];
583575
for (var pluginRegistry in _registries) {
@@ -612,6 +604,10 @@ class PluginServer {
612604
case protocol.PLUGIN_REQUEST_VERSION_CHECK:
613605
var params = protocol.PluginVersionCheckParams.fromRequest(request);
614606
result = await handlePluginVersionCheck(params);
607+
608+
default:
609+
// Anything else is unsupported.
610+
result = null;
615611
}
616612
if (result == null) {
617613
return Response(

0 commit comments

Comments
 (0)