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/src/generated/source.dart'; |
| 8 import 'package:analyzer_plugin/protocol/protocol_common.dart' |
| 9 hide AnalysisError; |
| 10 import 'package:analyzer_plugin/utilities/highlights/highlights.dart'; |
| 11 |
| 12 /** |
| 13 * A concrete implementation of [DartHighlightsRequest]. |
| 14 */ |
| 15 class DartHighlightsRequestImpl implements DartHighlightsRequest { |
| 16 @override |
| 17 final ResourceProvider resourceProvider; |
| 18 |
| 19 @override |
| 20 final ResolveResult result; |
| 21 |
| 22 /** |
| 23 * Initialize a newly create request with the given data. |
| 24 */ |
| 25 DartHighlightsRequestImpl(this.resourceProvider, this.result); |
| 26 |
| 27 @override |
| 28 String get path => result.path; |
| 29 } |
| 30 |
| 31 /** |
| 32 * A concrete implementation of [HighlightsCollector]. |
| 33 */ |
| 34 class HighlightsCollectorImpl implements HighlightsCollector { |
| 35 /** |
| 36 * The regions that have been collected. |
| 37 */ |
| 38 List<HighlightRegion> regions = <HighlightRegion>[]; |
| 39 |
| 40 @override |
| 41 void addRange(SourceRange range, HighlightRegionType type) { |
| 42 regions.add(new HighlightRegion(type, range.offset, range.length)); |
| 43 } |
| 44 |
| 45 @override |
| 46 void addRegion(int offset, int length, HighlightRegionType type) { |
| 47 regions.add(new HighlightRegion(type, offset, length)); |
| 48 } |
| 49 } |
OLD | NEW |