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

Unified Diff: pkg/analyzer_plugin/lib/utilities/navigation/navigation.dart

Issue 2927603003: Add a mixin to handle analysis.getNavigation requests (Closed)
Patch Set: bug fix Created 3 years, 6 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
« no previous file with comments | « pkg/analyzer_plugin/lib/plugin/navigation_mixin.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_plugin/lib/utilities/navigation/navigation.dart
diff --git a/pkg/analyzer_plugin/lib/utilities/navigation/navigation.dart b/pkg/analyzer_plugin/lib/utilities/navigation/navigation.dart
index a7876195ffa680aeb65dbb0e5cfeda807559c336..f70fda8fd12d1d10f952e79845eb68a0d32a1cfc 100644
--- a/pkg/analyzer_plugin/lib/utilities/navigation/navigation.dart
+++ b/pkg/analyzer_plugin/lib/utilities/navigation/navigation.dart
@@ -79,6 +79,29 @@ class NavigationGenerator {
.toNotification());
return new GeneratorResult(null, notifications);
}
+
+ /**
+ * Create an 'analysis.getNavigation' response for the portion of the file
+ * specified by the given [request]. If any of the contributors throws an
+ * exception, also create a non-fatal 'plugin.error' notification.
+ */
+ GeneratorResult generateNavigationResponse(NavigationRequest request) {
+ List<Notification> notifications = <Notification>[];
+ NavigationCollectorImpl collector = new NavigationCollectorImpl();
+ for (NavigationContributor contributor in contributors) {
+ try {
+ contributor.computeNavigation(request, collector);
+ } catch (exception, stackTrace) {
+ notifications.add(new PluginErrorParams(
+ false, exception.toString(), stackTrace.toString())
+ .toNotification());
+ }
+ }
+ collector.createRegions();
+ AnalysisGetNavigationResult result = new AnalysisGetNavigationResult(
+ collector.files, collector.targets, collector.regions);
+ return new GeneratorResult(result, notifications);
+ }
}
/**
« no previous file with comments | « pkg/analyzer_plugin/lib/plugin/navigation_mixin.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698