OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import 'package:analyzer/dart/analysis/results.dart'; | |
6 import 'package:analyzer/file_system/file_system.dart'; | |
7 import 'package:analyzer_plugin/protocol/protocol_common.dart'; | |
8 import 'package:analyzer_plugin/utilities/completion.dart'; | |
9 | |
10 /** | |
11 * An object that can collect completion suggestions. | |
12 */ | |
13 class CompletionCollectorImpl implements CompletionCollector { | |
14 @override | |
15 int length; | |
16 | |
17 @override | |
18 int offset; | |
19 | |
20 /** | |
21 * A list of the completion suggestions that have been collected. | |
22 */ | |
23 List<CompletionSuggestion> suggestions; | |
24 | |
25 /** | |
26 * Initialize a newly created completion collector. | |
27 */ | |
28 CompletionCollectorImpl(); | |
29 | |
30 @override | |
31 void addSuggestion(CompletionSuggestion suggestion) { | |
32 suggestions.add(suggestion); | |
33 } | |
34 } | |
35 | |
36 /** | |
37 * Information about the completion request that was made. | |
38 */ | |
39 class CompletionRequestImpl implements CompletionRequest { | |
40 @override | |
41 final int offset; | |
42 | |
43 @override | |
44 final ResourceProvider resourceProvider; | |
45 | |
46 @override | |
47 final ResolveResult result; | |
mfairhurst
2017/05/31 21:49:34
I mentioned this elsewhere in an email, this `resu
Brian Wilkerson
2017/05/31 22:51:47
Actually, you need this field because it's needed
mfairhurst
2017/05/31 23:17:36
Strictly speaking, I don't think either use this f
| |
48 | |
49 /** | |
50 * A flag indicating whether completion has been aborted. | |
51 */ | |
52 bool _aborted = false; | |
53 | |
54 /** | |
55 * Initialize a newly created request. | |
56 */ | |
57 CompletionRequestImpl(this.resourceProvider, this.result, this.offset); | |
58 | |
59 /** | |
60 * Abort the current completion request. | |
61 */ | |
62 void abort() { | |
63 _aborted = true; | |
64 } | |
65 | |
66 @override | |
67 void checkAborted() { | |
68 if (_aborted) { | |
69 throw new AbortCompletion(); | |
70 } | |
71 } | |
72 } | |
OLD | NEW |