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

Side by Side Diff: pkg/analysis_server/lib/plugin/edit/assist/assist_dart.dart

Issue 1409353002: Clean up wording of client usage expectations (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library analysis_server.plugin.edit.assist.assist_dart; 5 library analysis_server.plugin.edit.assist.assist_dart;
6 6
7 import 'package:analysis_server/plugin/edit/assist/assist_core.dart'; 7 import 'package:analysis_server/plugin/edit/assist/assist_core.dart';
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/source.dart'; 10 import 'package:analyzer/src/generated/source.dart';
11 11
12 /** 12 /**
13 * An [AssistContributor] that can be used to contribute assists for Dart 13 * An [AssistContributor] that can be used to contribute assists for Dart
14 * files. 14 * files.
15 * 15 *
16 * Clients are expected to extend this class when implementing plugins. 16 * Clients may extend this class when implementing plugins.
17 */ 17 */
18 abstract class DartAssistContributor extends AssistContributor { 18 abstract class DartAssistContributor implements AssistContributor {
19 @override 19 @override
20 List<Assist> computeAssists( 20 List<Assist> computeAssists(
21 AnalysisContext context, Source source, int offset, int length) { 21 AnalysisContext context, Source source, int offset, int length) {
22 if (!AnalysisEngine.isDartFileName(source.fullName)) { 22 if (!AnalysisEngine.isDartFileName(source.fullName)) {
23 return Assist.EMPTY_LIST; 23 return Assist.EMPTY_LIST;
24 } 24 }
25 List<Source> libraries = context.getLibrariesContaining(source); 25 List<Source> libraries = context.getLibrariesContaining(source);
26 if (libraries.isEmpty) { 26 if (libraries.isEmpty) {
27 return Assist.EMPTY_LIST; 27 return Assist.EMPTY_LIST;
28 } 28 }
29 CompilationUnit unit = 29 CompilationUnit unit =
30 context.resolveCompilationUnit2(source, libraries[0]); 30 context.resolveCompilationUnit2(source, libraries[0]);
31 if (unit == null) { 31 if (unit == null) {
32 return Assist.EMPTY_LIST; 32 return Assist.EMPTY_LIST;
33 } 33 }
34 return internalComputeAssists(unit, offset, length); 34 return internalComputeAssists(unit, offset, length);
35 } 35 }
36 36
37 /** 37 /**
38 * Return a list of assists for a location in the given [source]. The location 38 * Return a list of assists for a location in the given [source]. The location
39 * is specified by the [offset] and [length] of the selected region. The 39 * is specified by the [offset] and [length] of the selected region. The
40 * [context] can be used to get additional information that is useful for 40 * [context] can be used to get additional information that is useful for
41 * computing assists. 41 * computing assists.
42 */ 42 */
43 List<Assist> internalComputeAssists( 43 List<Assist> internalComputeAssists(
44 CompilationUnit unit, int offset, int length); 44 CompilationUnit unit, int offset, int length);
45 } 45 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/plugin/edit/assist/assist_core.dart ('k') | pkg/analysis_server/lib/plugin/edit/fix/fix_core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698