| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/services/search/search_engine.dart'; | 7 import 'package:analysis_server/src/services/search/search_engine.dart'; |
| 8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
| 9 import 'package:analyzer/src/dart/analysis/driver.dart'; | 9 import 'package:analyzer/src/dart/analysis/driver.dart'; |
| 10 import 'package:analyzer/src/dart/analysis/search.dart'; | 10 import 'package:analyzer/src/dart/analysis/search.dart'; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 List<SearchResult> allResults = []; | 41 List<SearchResult> allResults = []; |
| 42 for (AnalysisDriver driver in _drivers) { | 42 for (AnalysisDriver driver in _drivers) { |
| 43 List<SearchResult> results = await driver.search.references(element); | 43 List<SearchResult> results = await driver.search.references(element); |
| 44 allResults.addAll(results); | 44 allResults.addAll(results); |
| 45 } | 45 } |
| 46 return allResults.map(_SearchMatch.forSearchResult).toList(); | 46 return allResults.map(_SearchMatch.forSearchResult).toList(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 @override | 49 @override |
| 50 Future<List<SearchMatch>> searchSubtypes(ClassElement type) async { | 50 Future<List<SearchMatch>> searchSubtypes(ClassElement type) async { |
| 51 // TODO(scheglov) implement | 51 List<SearchResult> allResults = []; |
| 52 return []; | 52 for (AnalysisDriver driver in _drivers) { |
| 53 List<SearchResult> results = await driver.search.subTypes(type); |
| 54 allResults.addAll(results); |
| 55 } |
| 56 return allResults.map(_SearchMatch.forSearchResult).toList(); |
| 53 } | 57 } |
| 54 | 58 |
| 55 @override | 59 @override |
| 56 Future<List<SearchMatch>> searchTopLevelDeclarations(String pattern) async { | 60 Future<List<SearchMatch>> searchTopLevelDeclarations(String pattern) async { |
| 57 // TODO(scheglov) implement | 61 // TODO(scheglov) implement |
| 58 return []; | 62 return []; |
| 59 } | 63 } |
| 60 } | 64 } |
| 61 | 65 |
| 62 class _SearchMatch implements SearchMatch { | 66 class _SearchMatch implements SearchMatch { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 144 } |
| 141 if (kind == SearchResultKind.WRITE) { | 145 if (kind == SearchResultKind.WRITE) { |
| 142 return MatchKind.WRITE; | 146 return MatchKind.WRITE; |
| 143 } | 147 } |
| 144 if (kind == SearchResultKind.INVOCATION) { | 148 if (kind == SearchResultKind.INVOCATION) { |
| 145 return MatchKind.INVOCATION; | 149 return MatchKind.INVOCATION; |
| 146 } | 150 } |
| 147 return MatchKind.REFERENCE; | 151 return MatchKind.REFERENCE; |
| 148 } | 152 } |
| 149 } | 153 } |
| OLD | NEW |