Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: pkg/analysis_server/lib/src/plugin/plugin_manager.dart

Issue 2795743002: Add context information to driver and add hooks for plugin management (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/plugin/plugin_manager.dart
diff --git a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart b/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
index 2d9f8ca1967b8d98f289bb2e1035f1a5994cbdda..d503d926eb1889d1a27d691c66c348f2d1e55191 100644
--- a/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
+++ b/pkg/analysis_server/lib/src/plugin/plugin_manager.dart
@@ -7,6 +7,7 @@ import 'dart:collection';
import 'dart:io' show Platform;
import 'package:analysis_server/src/plugin/notification_manager.dart';
+import 'package:analyzer/context/context_root.dart' as analyzer;
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/instrumentation/instrumentation.dart';
import 'package:analyzer/src/generated/bazel.dart';
@@ -57,7 +58,7 @@ class PluginInfo {
* The context roots that are currently using the results produced by the
* plugin.
*/
- Set<ContextRoot> contextRoots = new HashSet<ContextRoot>();
+ Set<analyzer.ContextRoot> contextRoots = new HashSet<analyzer.ContextRoot>();
/**
* The current execution of the plugin, or `null` if the plugin is not
@@ -75,7 +76,7 @@ class PluginInfo {
* Add the given [contextRoot] to the set of context roots being analyzed by
* this plugin.
*/
- void addContextRoot(ContextRoot contextRoot) {
+ void addContextRoot(analyzer.ContextRoot contextRoot) {
if (contextRoots.add(contextRoot)) {
_updatePluginRoots();
}
@@ -85,7 +86,7 @@ class PluginInfo {
* Remove the given [contextRoot] from the set of context roots being analyzed
* by this plugin.
*/
- void removeContextRoot(ContextRoot contextRoot) {
+ void removeContextRoot(analyzer.ContextRoot contextRoot) {
if (contextRoots.remove(contextRoot)) {
_updatePluginRoots();
}
@@ -121,8 +122,11 @@ class PluginInfo {
*/
void _updatePluginRoots() {
if (currentSession != null) {
- AnalysisSetContextRootsParams params =
- new AnalysisSetContextRootsParams(contextRoots.toList());
+ AnalysisSetContextRootsParams params = new AnalysisSetContextRootsParams(
+ contextRoots
+ .map((analyzer.ContextRoot contextRoot) =>
+ new ContextRoot(contextRoot.root, contextRoot.exclude))
+ .toList());
currentSession.sendRequest(params);
}
}
@@ -171,7 +175,7 @@ class PluginManager {
* yet been started, then it will be started by this method.
*/
Future<Null> addPluginToContextRoot(
- ContextRoot contextRoot, String path) async {
+ analyzer.ContextRoot contextRoot, String path) async {
PluginInfo plugin = _pluginMap[path];
if (plugin == null) {
List<String> pluginPaths = _pathsFor(path);
@@ -195,7 +199,7 @@ class PluginManager {
* response.
*/
List<Future<Response>> broadcast(
- ContextRoot contextRoot, RequestParams params) {
+ analyzer.ContextRoot contextRoot, RequestParams params) {
List<PluginInfo> plugins = pluginsForContextRoot(contextRoot);
return plugins
.map((PluginInfo plugin) => plugin.currentSession?.sendRequest(params))
@@ -207,7 +211,7 @@ class PluginManager {
* given [contextRoot].
*/
@visibleForTesting
- List<PluginInfo> pluginsForContextRoot(ContextRoot contextRoot) {
+ List<PluginInfo> pluginsForContextRoot(analyzer.ContextRoot contextRoot) {
List<PluginInfo> plugins = <PluginInfo>[];
for (PluginInfo plugin in _pluginMap.values) {
if (plugin.contextRoots.contains(contextRoot)) {
@@ -220,7 +224,7 @@ class PluginManager {
/**
* The given [contextRoot] is no longer being analyzed.
*/
- void removedContextRoot(ContextRoot contextRoot) {
+ void removedContextRoot(analyzer.ContextRoot contextRoot) {
List<PluginInfo> plugins = _pluginMap.values.toList();
for (PluginInfo plugin in plugins) {
plugin.removeContextRoot(contextRoot);
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | pkg/analysis_server/lib/src/plugin/plugin_watcher.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698