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

Unified Diff: pkg/analysis_server/lib/analysis/navigation/navigation_core.dart

Issue 1303033010: Navigation extension point. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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/analysis/navigation/navigation_core.dart
diff --git a/pkg/analysis_server/lib/analysis/navigation/navigation_core.dart b/pkg/analysis_server/lib/analysis/navigation/navigation_core.dart
new file mode 100644
index 0000000000000000000000000000000000000000..53ae022f79689a8cf5c10178ff2c5faff20ff005
--- /dev/null
+++ b/pkg/analysis_server/lib/analysis/navigation/navigation_core.dart
@@ -0,0 +1,55 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library analysis_server.analysis.navigation.navigation_core;
+
+import 'package:analysis_server/src/protocol.dart'
+ show ElementKind, Location, NavigationRegion, NavigationTarget;
+import 'package:analyzer/src/generated/engine.dart' show AnalysisContext;
+import 'package:analyzer/src/generated/source.dart' show Source;
+
+/**
+ * An object used to produce navigation regions.
+ *
+ * Clients are expected to subtype this class when implementing plugins.
+ */
+abstract class NavigationContributor {
+ /**
+ * Contribute navigation regions for a part of the given [source] into the
+ * given [holder]. The part is specified by the [offset] and [length].
+ * The [context] can be used to get analysis results.
+ */
+ void computeNavigation(NavigationHolder holder, AnalysisContext context,
+ Source source, int offset, int length);
+}
+
+/**
+ * An object that [NavigationContributor]s use to record navigation regions
+ * into.
+ *
+ * Clients are not expected to subtype this class.
+ */
+abstract class NavigationHolder {
Brian Wilkerson 2015/09/01 14:55:42 I don't think clients need the getters, so I'd lik
scheglov 2015/09/01 20:06:14 Done.
+ /**
+ * All the unique files referenced by [targets].
+ */
+ List<String> get files;
+
+ /**
+ * A list of navigation regions.
+ */
+ List<NavigationRegion> get regions;
+
+ /**
+ * All the unique targets referenced by [regions].
+ */
+ List<NavigationTarget> get targets;
+
+ /**
+ * Record a new navigation region with the given [offset] and [length] that
+ * should navigation to the given [targetLocation].
+ */
+ void addRegion(
+ int offset, int length, ElementKind targetKind, Location targetLocation);
+}

Powered by Google App Engine
This is Rietveld 408576698