Skip to content

Commit 649944c

Browse files
srawlinsCommit Queue
authored andcommitted
DAS plugins: Rename PluginInfo to PluginIsolate; move to separate library
Work towards #61386 A few distinct changes: * Rename PluginInfo to PluginIsolate * Move PluginInfo and PluginSession to a new library, plugin_isolate.dart. PluginSession is _essentially_ a private class to PluginIsolate, so it's good to co-locate them. * Move PluginInfo tests and PluginSession tests to a new library. * Extract out shared parent class for PluginManager tests, PluginIsolate tests, and PluginSession tests. Change-Id: Ib0c638b8797f51c57c07e277acdaea6d8202f957 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/446960 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent 44e67b1 commit 649944c

17 files changed

+1052
-976
lines changed

pkg/analysis_server/lib/src/analysis_server.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import 'package:analysis_server/src/lsp/handlers/handler_execute_command.dart'
2020
import 'package:analysis_server/src/lsp/handlers/handler_states.dart' as lsp;
2121
import 'package:analysis_server/src/lsp/handlers/handlers.dart' as lsp;
2222
import 'package:analysis_server/src/plugin/notification_manager.dart';
23+
import 'package:analysis_server/src/plugin/plugin_isolate.dart';
2324
import 'package:analysis_server/src/plugin/plugin_manager.dart';
2425
import 'package:analysis_server/src/plugin/plugin_watcher.dart';
2526
import 'package:analysis_server/src/protocol_server.dart'
@@ -508,12 +509,12 @@ abstract class AnalysisServer {
508509
/// [driver]. Return a list containing futures that will complete when each of
509510
/// the plugins have sent a response, or an empty list if no [driver] is
510511
/// provided.
511-
Map<PluginInfo, Future<Response>> broadcastRequestToPlugins(
512+
Map<PluginIsolate, Future<Response>> broadcastRequestToPlugins(
512513
analyzer_plugin.RequestParams requestParams,
513514
analysis.AnalysisDriver? driver,
514515
) {
515516
if (driver == null) {
516-
return <PluginInfo, Future<Response>>{};
517+
return <PluginIsolate, Future<Response>>{};
517518
}
518519
return pluginManager.broadcastRequest(
519520
requestParams,

pkg/analysis_server/lib/src/analytics/plugin_data.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import 'dart:convert';
66

77
import 'package:analysis_server/src/analytics/percentile_calculator.dart';
8+
import 'package:analysis_server/src/plugin/plugin_isolate.dart';
89
import 'package:analysis_server/src/plugin/plugin_manager.dart';
910
import 'package:path/path.dart' as path;
1011

@@ -28,10 +29,10 @@ class PluginData {
2829
/// [pluginManager].
2930
void recordPlugins(PluginManager pluginManager) {
3031
recordCount++;
31-
for (var info in pluginManager.plugins) {
32+
for (var isolate in pluginManager.pluginIsolates) {
3233
usageCounts
33-
.putIfAbsent(info.safePluginId, () => PercentileCalculator())
34-
.addValue(info.contextRoots.length);
34+
.putIfAbsent(isolate.safePluginId, () => PercentileCalculator())
35+
.addValue(isolate.contextRoots.length);
3536
}
3637
}
3738

@@ -41,7 +42,7 @@ class PluginData {
4142
};
4243
}
4344

44-
extension PluginInfoExtension on PluginInfo {
45+
extension PluginIsolateExtension on PluginIsolate {
4546
/// An ID for this plugin that doesn't contain any PII.
4647
///
4748
/// If the plugin is installed in the pub cache and hosted on `pub.dev`, then

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,10 @@ class ServerCapabilitiesComputer {
150150
ServerCapabilitiesComputer(this._server);
151151

152152
List<TextDocumentFilterScheme> get pluginTypes =>
153-
_server.pluginManager.plugins
153+
_server.pluginManager.pluginIsolates
154154
.expand(
155-
(plugin) => plugin.currentSession?.interestingFiles ?? const [],
155+
(isolate) =>
156+
isolate.currentSession?.interestingFiles ?? const <String>[],
156157
)
157158
// All published plugins use something like `*.extension` as
158159
// interestingFiles. Prefix a `**/` so that the glob matches nested

0 commit comments

Comments
 (0)