OLD | NEW |
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 services.completion.dart.manager; | 5 library services.completion.dart.manager; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
10 import 'package:analysis_server/src/provisional/completion/completion_core.dart' | 10 import 'package:analysis_server/src/provisional/completion/completion_core.dart' |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } | 222 } |
223 | 223 |
224 OpType get opType { | 224 OpType get opType { |
225 if (_opType == null) { | 225 if (_opType == null) { |
226 _opType = new OpType.forCompletion(target, offset); | 226 _opType = new OpType.forCompletion(target, offset); |
227 } | 227 } |
228 return _opType; | 228 return _opType; |
229 } | 229 } |
230 | 230 |
231 @override | 231 @override |
232 String get sourceContents => context.getContents(source)?.data; | 232 String get sourceContents { |
| 233 if (result != null) { |
| 234 return result.content; |
| 235 } else { |
| 236 return context.getContents(source)?.data; |
| 237 } |
| 238 } |
233 | 239 |
234 @override | 240 @override |
235 SourceFactory get sourceFactory { | 241 SourceFactory get sourceFactory { |
236 return context?.sourceFactory ?? result.sourceFactory; | 242 return context?.sourceFactory ?? result.sourceFactory; |
237 } | 243 } |
238 | 244 |
239 /** | 245 /** |
240 * Throw [AbortCompletion] if the completion request has been aborted. | 246 * Throw [AbortCompletion] if the completion request has been aborted. |
241 */ | 247 */ |
242 void checkAborted() { | 248 void checkAborted() { |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 if (start <= requestOffset && requestOffset <= end) { | 543 if (start <= requestOffset && requestOffset <= end) { |
538 // Replacement range for import URI | 544 // Replacement range for import URI |
539 return new ReplacementRange(start, end - start); | 545 return new ReplacementRange(start, end - start); |
540 } | 546 } |
541 } | 547 } |
542 } | 548 } |
543 } | 549 } |
544 return new ReplacementRange(requestOffset, 0); | 550 return new ReplacementRange(requestOffset, 0); |
545 } | 551 } |
546 } | 552 } |
OLD | NEW |