Chromium Code Reviews| Index: pkg/analyzer_plugin/lib/plugin/navigation_mixin.dart |
| diff --git a/pkg/analyzer_plugin/lib/plugin/navigation_mixin.dart b/pkg/analyzer_plugin/lib/plugin/navigation_mixin.dart |
| index 9a2d3b41016c44eabb0092e3e37fc10e258b7893..985a7f89d2815872547e196a12f59101f6901e78 100644 |
| --- a/pkg/analyzer_plugin/lib/plugin/navigation_mixin.dart |
| +++ b/pkg/analyzer_plugin/lib/plugin/navigation_mixin.dart |
| @@ -29,8 +29,14 @@ abstract class DartNavigationMixin implements NavigationMixin { |
| AnalysisGetNavigationParams parameters) async { |
| String path = parameters.file; |
| ResolveResult result = await getResolveResult(path); |
| + int offset = parameters.offset; |
| + int length = parameters.length; |
| + if (offset < 0 && length < 0) { |
| + offset = 0; |
| + length = result.content.length; |
| + } |
| return new DartNavigationRequestImpl( |
| - resourceProvider, parameters.offset, parameters.length, result); |
| + resourceProvider, offset, length, result); |
| } |
| } |
| @@ -69,4 +75,25 @@ abstract class NavigationMixin implements ServerPlugin { |
| result.sendNotifications(channel); |
| return result.result; |
| } |
| + |
| + /** |
| + * Send a navigation notification for the file with the given [path] to the |
| + * server. If a [result] is provided then it is expected to be the result of |
|
scheglov
2017/08/23 21:36:21
What [result]?
Brian Wilkerson
2017/08/24 14:27:58
Removed.
|
| + * analyzing the file at the given [path] and will be used to build the |
| + * [NavigationRequest] that is passed to the navigation contributors. |
| + */ |
| + @override |
| + Future<Null> sendNavigationNotification(String path) async { |
| + try { |
| + NavigationRequest request = await getNavigationRequest( |
| + new AnalysisGetNavigationParams(path, -1, -1)); |
| + NavigationGenerator generator = |
| + new NavigationGenerator(getNavigationContributors(request.path)); |
| + GeneratorResult generatorResult = |
| + await generator.generateNavigationNotification(request); |
| + generatorResult.sendNotifications(channel); |
| + } on RequestFailure { |
| + // If we couldn't analyze the file, then don't send a notification. |
| + } |
| + } |
| } |