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

Side by Side Diff: pkg/analysis_server/lib/completion/completion_core.dart

Issue 1084793006: Add file missed in previous CL and comment clean-up (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/lib/completion/completion_dart.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.completion.completion_core; 5 library analysis_server.completion.completion_core;
6 6
7 import 'package:analysis_server/src/protocol.dart';
7 import 'package:analyzer/src/generated/engine.dart'; 8 import 'package:analyzer/src/generated/engine.dart';
8 import 'package:analysis_server/src/protocol.dart';
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 10
11 /**
12 * An object used to produce completions for a specific error. Completion
13 * contributors are long-lived objects and must not retain any state between
14 * invocations of [computeSuggestions].
15 *
16 * Clients are expected to subtype this class when implementing plugins.
17 */
11 abstract class CompletionContributor { 18 abstract class CompletionContributor {
12 /** 19 /**
13 * Compute a list of completion suggestions based on the given completion 20 * Compute a list of completion suggestions based on the given completion
14 * [request] and return a result that includes those suggestions. This method 21 * [request] and return a result that includes those suggestions. This method
15 * is called after specific phases of analysis until the contributor indicates 22 * is called after specific phases of analysis until the contributor indicates
16 * computation is complete by setting [CompletionResult.isLast] to `true`. 23 * computation is complete by setting [CompletionResult.isLast] to `true`.
17 */ 24 */
18 CompletionResult computeSuggestions(CompletionRequest request); 25 CompletionResult computeSuggestions(CompletionRequest request);
19 } 26 }
20 27
21 /** 28 /**
22 * The information about a requested list of completions. 29 * The information about a requested list of completions.
30 *
31 * Clients are not expected to subtype this class.
23 */ 32 */
24 abstract class CompletionRequest { 33 abstract class CompletionRequest {
25 /** 34 /**
26 * Return the analysis context in which the completion is being requested. 35 * Return the analysis context in which the completion is being requested.
27 */ 36 */
28 AnalysisContext get context; 37 AnalysisContext get context;
29 38
30 /** 39 /**
40 * The offset within the source at which the completion is being requested.
41 */
42 int get offset;
43
44 /**
31 * Return the results that were returned the last time the contributor was 45 * Return the results that were returned the last time the contributor was
32 * asked for results, or `null` if this is the first request for results at 46 * asked for results, or `null` if this is the first request for results at
33 * this location. 47 * this location.
34 */ 48 */
35 CompletionResult get previousResults; 49 CompletionResult get previousResults;
36 50
37 /** 51 /**
38 * Return the source in which the completion is being requested. 52 * Return the source in which the completion is being requested.
39 */ 53 */
40 Source get source; 54 Source get source;
41
42 /**
43 * The offset within the source at which the completion is being requested.
44 */
45 int get offset;
46 } 55 }
47 56
57 /**
58 * The result of computing suggestions for code completion.
59 *
60 * Clients are expected to subtype this class when implementing plugins.
61 */
48 abstract class CompletionResult { 62 abstract class CompletionResult {
49 /** 63 /**
50 * Return `true` if this result contains suggestions that were not in the 64 * Return `true` if this result contains suggestions that were not in the
51 * previously returned completion results. This should also be `true` if this 65 * previously returned completion results. This should also be `true` if this
52 * is the first result produced for a given location. 66 * is the first result produced for a given location.
53 */ 67 */
54 bool get hasNewSuggestions; 68 bool get hasNewSuggestions;
55 69
56 /** 70 /**
57 * Return `true` if the contributor has contributed all possible completion 71 * Return `true` if the contributor has contributed all possible completion
58 * suggestions, or `false` if the contributor should be consulted again after 72 * suggestions, or `false` if the contributor should be consulted again after
59 * more analysis has been completed. 73 * more analysis has been completed.
60 */ 74 */
61 bool get isLast; 75 bool get isLast;
62 76
63 /** 77 /**
78 * Return the length of the text to be replaced. This will be zero (0) if the
79 * suggestion is to be inserted, otherwise it will be greater than zero. For
80 * example, if the remainder of the identifier containing the cursor is to be
81 * replaced when the suggestion is applied, in which case the length will be
82 * the number of characters in the existing identifier.
83 */
84 int get replacementLength;
85
86 /**
64 * Return the offset of the start of the text to be replaced. This will be 87 * Return the offset of the start of the text to be replaced. This will be
65 * different than the offset used to request the completion suggestions if 88 * different than the offset used to request the completion suggestions if
66 * there was a portion of text that needs to be replaced. For example, if a 89 * there was a portion of text that needs to be replaced. For example, if a
67 * partial identifier is immediately before the original offset, in which case 90 * partial identifier is immediately before the original offset, in which case
68 * the replacementOffset will be the offset of the beginning of the 91 * the replacementOffset will be the offset of the beginning of the
69 * identifier. 92 * identifier.
70 */ 93 */
71 int get replacementOffset; 94 int get replacementOffset;
72 95
73 /** 96 /**
74 * Return the length of the text to be replaced. This will be zero (0) if the
75 * suggestion is to be inserted, otherwise it will be greater than zero. For
76 * example, if the remainder of the identifier containing the cursor is to be
77 * replaced when the suggestion is applied, in which case the length will be
78 * the number of characters in the existing identifier.
79 */
80 int get replacementLength;
81
82 /**
83 * Return the list of suggestions being contributed by the contributor. 97 * Return the list of suggestions being contributed by the contributor.
84 */ 98 */
85 List<CompletionSuggestion> get suggestions; 99 List<CompletionSuggestion> get suggestions;
86 } 100 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/completion/completion_dart.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698