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
https://github.com/dart-lang/sdk/commit/da1d59c4e6cdb65b48db8ff182cf77f377ca8d1b
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 <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
Sam Rawlins
2025-09-11 17:21:45 -07:00
committed by Commit Queue
parent b6b20c8907
commit cbb3237f04
@@ -542,7 +542,6 @@ class PluginServer {
Future<Response?> _getResponse(Request request, int requestTime) async {
ResponseResult? result;
switch (request.method) {
case protocol.ANALYSIS_REQUEST_GET_NAVIGATION:
case protocol.ANALYSIS_REQUEST_HANDLE_WATCH_EVENTS:
var params = protocol.AnalysisHandleWatchEventsParams.fromRequest(
request,
@@ -556,28 +555,21 @@ class PluginServer {
result = await _handleAnalysisSetContextRoots(params);
case protocol.ANALYSIS_REQUEST_SET_PRIORITY_FILES:
case protocol.ANALYSIS_REQUEST_SET_SUBSCRIPTIONS:
// TODO(srawlins): Support!
result = null;
case protocol.ANALYSIS_REQUEST_UPDATE_CONTENT:
var params = protocol.AnalysisUpdateContentParams.fromRequest(request);
result = await _handleAnalysisUpdateContent(params);
case protocol.COMPLETION_REQUEST_GET_SUGGESTIONS:
result = null;
case protocol.EDIT_REQUEST_GET_ASSISTS:
var params = protocol.EditGetAssistsParams.fromRequest(request);
result = await handleEditGetAssists(params);
case protocol.EDIT_REQUEST_GET_AVAILABLE_REFACTORINGS:
result = null;
case protocol.EDIT_REQUEST_GET_FIXES:
var params = protocol.EditGetFixesParams.fromRequest(request);
result = await handleEditGetFixes(params);
case protocol.EDIT_REQUEST_GET_REFACTORING:
result = null;
case protocol.PLUGIN_REQUEST_DETAILS:
var details = <protocol.PluginDetails>[];
for (var pluginRegistry in _registries) {
@@ -612,6 +604,10 @@ class PluginServer {
case protocol.PLUGIN_REQUEST_VERSION_CHECK:
var params = protocol.PluginVersionCheckParams.fromRequest(request);
result = await handlePluginVersionCheck(params);
default:
// Anything else is unsupported.
result = null;
}
if (result == null) {
return Response(