Skip to content

Commit 046c968

Browse files
srawlinsCommit Queue
authored andcommitted
DAS plugins: minor adjustments regarding the PluginIsolateChannel
It looks like PluginCommunicationChannel.listen cannot do anything with `onError`, so don't pass anything as if it did. See ReceivePort.listen docs as well: https://api.dart.dev/dev/latest/dart-isolate/ReceivePort/listen.html Change-Id: Iaaf1169a1f05774f63bdcea4c91a82dfb9e47227 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396526 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent 237bb3b commit 046c968

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

pkg/analysis_server_plugin/lib/src/plugin_server.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,6 @@ class PluginServer {
180180
void start(PluginCommunicationChannel channel) {
181181
_channel = channel;
182182
_channel.listen(_handleRequestZoned,
183-
// TODO(srawlins): Implement.
184-
onError: (_) {},
185183
// TODO(srawlins): Implement.
186184
onDone: () {});
187185
}

pkg/analyzer_plugin/lib/channel/channel.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
/// @docImport 'package:analyzer_plugin/plugin/plugin.dart';
6+
library;
7+
58
import 'package:analyzer_plugin/protocol/protocol.dart';
69

710
/// A communication channel that allows a [ServerPlugin] to receive [Request]s

pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ class PluginIsolateChannel implements PluginCommunicationChannel {
102102
if (_subscription != null) {
103103
throw StateError('Only one listener is allowed per channel');
104104
}
105+
// Note: The documentation for [ReceivePort.listen] indicates that
106+
// `onError` and `cancelOnError` are always ignored, "since a ReceivePort
107+
// will never receive an error." It is potentially confusing to pass them
108+
// here, as if they had an effect. Consider removing.
105109
_subscription = _receivePort.listen(onData,
106110
onError: onError, onDone: onDone, cancelOnError: false);
107111
}

0 commit comments

Comments
 (0)