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

Side by Side Diff: pkg/analyzer_plugin/lib/utilities/navigation/navigation.dart

Issue 2953093002: Update the plugin API (Closed)
Patch Set: Update FixesRequest 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:analyzer/dart/analysis/results.dart'; 5 import 'package:analyzer/dart/analysis/results.dart';
6 import 'package:analyzer/file_system/file_system.dart'; 6 import 'package:analyzer/file_system/file_system.dart';
7 import 'package:analyzer_plugin/protocol/protocol.dart'; 7 import 'package:analyzer_plugin/protocol/protocol.dart';
8 import 'package:analyzer_plugin/protocol/protocol_common.dart' 8 import 'package:analyzer_plugin/protocol/protocol_common.dart'
9 show ElementKind, Location; 9 show ElementKind, Location;
10 import 'package:analyzer_plugin/protocol/protocol_generated.dart'; 10 import 'package:analyzer_plugin/protocol/protocol_generated.dart';
11 import 'package:analyzer_plugin/src/utilities/navigation/navigation.dart'; 11 import 'package:analyzer_plugin/src/utilities/navigation/navigation.dart';
12 import 'package:analyzer_plugin/utilities/generator.dart'; 12 import 'package:analyzer_plugin/utilities/generator.dart';
13 13
14 /** 14 /**
15 * The information about a requested set of navigation information when
16 * computing navigation information in a `.dart` file.
17 *
18 * Clients may not extend, implement or mix-in this class.
19 */
20 abstract class DartNavigationRequest implements NavigationRequest {
21 /**
22 * The analysis result for the file in which the navigation regions are being
23 * requested.
24 */
25 ResolveResult get result;
26 }
27
28 /**
15 * An object that [NavigationContributor]s use to record navigation regions. 29 * An object that [NavigationContributor]s use to record navigation regions.
16 * 30 *
17 * Clients may not extend, implement or mix-in this class. 31 * Clients may not extend, implement or mix-in this class.
18 */ 32 */
19 abstract class NavigationCollector { 33 abstract class NavigationCollector {
20 /** 34 /**
21 * Record a new navigation region with the given [offset] and [length] that 35 * Record a new navigation region with the given [offset] and [length] that
22 * should navigate to the given [targetLocation]. 36 * should navigate to the given [targetLocation].
23 */ 37 */
24 void addRegion( 38 void addRegion(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 for (NavigationContributor contributor in contributors) { 81 for (NavigationContributor contributor in contributors) {
68 try { 82 try {
69 contributor.computeNavigation(request, collector); 83 contributor.computeNavigation(request, collector);
70 } catch (exception, stackTrace) { 84 } catch (exception, stackTrace) {
71 notifications.add(new PluginErrorParams( 85 notifications.add(new PluginErrorParams(
72 false, exception.toString(), stackTrace.toString()) 86 false, exception.toString(), stackTrace.toString())
73 .toNotification()); 87 .toNotification());
74 } 88 }
75 } 89 }
76 collector.createRegions(); 90 collector.createRegions();
77 notifications.add(new AnalysisNavigationParams(request.result.path, 91 notifications.add(new AnalysisNavigationParams(
78 collector.regions, collector.targets, collector.files) 92 request.path, collector.regions, collector.targets, collector.files)
79 .toNotification()); 93 .toNotification());
80 return new GeneratorResult(null, notifications); 94 return new GeneratorResult(null, notifications);
81 } 95 }
82 96
83 /** 97 /**
84 * Create an 'analysis.getNavigation' response for the portion of the file 98 * Create an 'analysis.getNavigation' response for the portion of the file
85 * specified by the given [request]. If any of the contributors throws an 99 * specified by the given [request]. If any of the contributors throws an
86 * exception, also create a non-fatal 'plugin.error' notification. 100 * exception, also create a non-fatal 'plugin.error' notification.
87 */ 101 */
88 GeneratorResult generateNavigationResponse(NavigationRequest request) { 102 GeneratorResult generateNavigationResponse(NavigationRequest request) {
(...skipping 27 matching lines...) Expand all
116 */ 130 */
117 int get length; 131 int get length;
118 132
119 /** 133 /**
120 * Return the offset of the region within the source for which navigation 134 * Return the offset of the region within the source for which navigation
121 * regions are being requested. 135 * regions are being requested.
122 */ 136 */
123 int get offset; 137 int get offset;
124 138
125 /** 139 /**
140 * Return the path of the file in which navigation regions are being requested .
141 */
142 String get path;
143
144 /**
126 * Return the resource provider associated with this request. 145 * Return the resource provider associated with this request.
127 */ 146 */
128 ResourceProvider get resourceProvider; 147 ResourceProvider get resourceProvider;
129
130 /**
131 * The analysis result for the file in which the navigation regions are being
132 * requested.
133 */
134 ResolveResult get result;
135 } 148 }
OLDNEW
« no previous file with comments | « pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart ('k') | pkg/analyzer_plugin/test/plugin/assist_mixin_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698