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

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

Issue 1115843003: restructure internal request to implement CompletionRequest API, (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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/src/domain_completion.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:analysis_server/src/protocol.dart';
8 import 'package:analyzer/file_system/file_system.dart';
8 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
9 import 'package:analyzer/src/generated/source.dart'; 10 import 'package:analyzer/src/generated/source.dart';
10 11
11 /** 12 /**
12 * An object used to produce completions for a specific error. Completion 13 * 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 * contributors are long-lived objects and must not retain any state between
14 * invocations of [computeSuggestions]. 15 * invocations of [computeSuggestions].
15 * 16 *
16 * Clients are expected to subtype this class when implementing plugins. 17 * Clients are expected to subtype this class when implementing plugins.
17 */ 18 */
18 abstract class CompletionContributor { 19 abstract class CompletionContributor {
19 /** 20 /**
20 * Compute a list of completion suggestions based on the given completion 21 * Compute a list of completion suggestions based on the given completion
21 * [request] and return a result that includes those suggestions. This method 22 * [request] and return a result that includes those suggestions. This method
22 * is called after specific phases of analysis until the contributor indicates 23 * is called after specific phases of analysis until the contributor indicates
23 * computation is complete by setting [CompletionResult.isLast] to `true`. 24 * computation is complete by setting [CompletionResult.isLast] to `true`.
24 */ 25 */
25 CompletionResult computeSuggestions(CompletionRequest request); 26 CompletionResult computeSuggestions(CompletionRequest request);
26 } 27 }
27 28
28 /** 29 /**
29 * The information about a requested list of completions. 30 * The information about a requested list of completions.
30 * 31 *
31 * Clients are not expected to subtype this class. 32 * Clients are not expected to subtype this class.
32 */ 33 */
33 abstract class CompletionRequest { 34 abstract class CompletionRequest {
34 /** 35 /**
36 * Return the results that were returned the last time the contributor was
37 * asked for results, or `null` if this is the first request for results at
38 * this location.
39 */
40 //CompletionResult get previousResults;
Brian Wilkerson 2015/04/30 04:01:22 I'm confused by this. If you're proposing that we
danrubel 2015/04/30 05:03:11 I'm not sure so I commented it out. As mentioned a
41
42 /**
35 * Return the analysis context in which the completion is being requested. 43 * Return the analysis context in which the completion is being requested.
36 */ 44 */
37 AnalysisContext get context; 45 AnalysisContext get context;
38 46
39 /** 47 /**
40 * The offset within the source at which the completion is being requested. 48 * The offset within the source at which the completion is being requested.
41 */ 49 */
42 int get offset; 50 int get offset;
43 51
44 /** 52 /**
45 * Return the results that were returned the last time the contributor was 53 * Return the resource provider associated with this request.
46 * asked for results, or `null` if this is the first request for results at
47 * this location.
48 */ 54 */
49 CompletionResult get previousResults; 55 ResourceProvider get provider;
Brian Wilkerson 2015/04/30 04:01:22 The name 'provider' is fairly generic. Perhaps 're
danrubel 2015/04/30 05:03:11 Good point. Renamed.
50 56
51 /** 57 /**
52 * Return the source in which the completion is being requested. 58 * Return the source in which the completion is being requested.
53 */ 59 */
54 Source get source; 60 Source get source;
55 } 61 }
56 62
57 /** 63 /**
58 * The result of computing suggestions for code completion. 64 * The result of computing suggestions for code completion.
59 * 65 *
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 * the replacementOffset will be the offset of the beginning of the 97 * the replacementOffset will be the offset of the beginning of the
92 * identifier. 98 * identifier.
93 */ 99 */
94 int get replacementOffset; 100 int get replacementOffset;
95 101
96 /** 102 /**
97 * Return the list of suggestions being contributed by the contributor. 103 * Return the list of suggestions being contributed by the contributor.
98 */ 104 */
99 List<CompletionSuggestion> get suggestions; 105 List<CompletionSuggestion> get suggestions;
100 } 106 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/domain_completion.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698