| OLD | NEW |
| 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_common.dart'; | 7 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
| 8 import 'package:analyzer_plugin/utilities/completion/completion_core.dart'; | 8 import 'package:analyzer_plugin/utilities/completion/completion_core.dart'; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 @override | 56 @override |
| 57 void set offset(int length) { | 57 void set offset(int length) { |
| 58 if (_offset != null) { | 58 if (_offset != null) { |
| 59 throw new StateError('The offset can only be set once'); | 59 throw new StateError('The offset can only be set once'); |
| 60 } | 60 } |
| 61 _offset = length; | 61 _offset = length; |
| 62 } | 62 } |
| 63 | 63 |
| 64 @override | 64 @override |
| 65 void addSuggestion(CompletionSuggestion suggestion) { | |
| 66 suggestions.add(suggestion); | |
| 67 } | |
| 68 | |
| 69 @override | |
| 70 bool get offsetIsSet => offset != null; | 65 bool get offsetIsSet => offset != null; |
| 71 | 66 |
| 72 @override | 67 @override |
| 73 int get suggestionsLength => suggestions.length; | 68 int get suggestionsLength => suggestions.length; |
| 69 |
| 70 @override |
| 71 void addSuggestion(CompletionSuggestion suggestion) { |
| 72 suggestions.add(suggestion); |
| 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 /** | 76 /** |
| 77 * Information about the completion request that was made. | 77 * A concrete implementation of [DartCompletionRequest]. |
| 78 */ | 78 */ |
| 79 class CompletionRequestImpl implements CompletionRequest { | 79 class DartCompletionRequestImpl implements DartCompletionRequest { |
| 80 @override |
| 81 final ResourceProvider resourceProvider; |
| 82 |
| 80 @override | 83 @override |
| 81 final int offset; | 84 final int offset; |
| 82 | 85 |
| 83 @override | 86 @override |
| 84 final ResourceProvider resourceProvider; | |
| 85 | |
| 86 @override | |
| 87 final ResolveResult result; | 87 final ResolveResult result; |
| 88 | 88 |
| 89 /** | 89 /** |
| 90 * A flag indicating whether completion has been aborted. | 90 * A flag indicating whether completion has been aborted. |
| 91 */ | 91 */ |
| 92 bool _aborted = false; | 92 bool _aborted = false; |
| 93 | 93 |
| 94 /** | 94 /** |
| 95 * Initialize a newly created request. | 95 * Initialize a newly created request. |
| 96 */ | 96 */ |
| 97 CompletionRequestImpl(this.resourceProvider, this.result, this.offset); | 97 DartCompletionRequestImpl(this.resourceProvider, this.offset, this.result); |
| 98 | 98 |
| 99 /** | 99 /** |
| 100 * Abort the current completion request. | 100 * Abort the current completion request. |
| 101 */ | 101 */ |
| 102 void abort() { | 102 void abort() { |
| 103 _aborted = true; | 103 _aborted = true; |
| 104 } | 104 } |
| 105 | 105 |
| 106 @override | 106 @override |
| 107 void checkAborted() { | 107 void checkAborted() { |
| 108 if (_aborted) { | 108 if (_aborted) { |
| 109 throw new AbortCompletion(); | 109 throw new AbortCompletion(); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 } | 112 } |
| OLD | NEW |