| Index: pkg/analysis_server/lib/src/domain_analysis.dart
|
| diff --git a/pkg/analysis_server/lib/src/domain_analysis.dart b/pkg/analysis_server/lib/src/domain_analysis.dart
|
| index eda11af60e4dd4e74c2208356a998195e0e7654c..431155ada5e23db6eb0303927603ea319914d394 100644
|
| --- a/pkg/analysis_server/lib/src/domain_analysis.dart
|
| +++ b/pkg/analysis_server/lib/src/domain_analysis.dart
|
| @@ -90,17 +90,17 @@ class AnalysisDomainHandler implements RequestHandler {
|
| var params = new AnalysisGetHoverParams.fromRequest(request);
|
|
|
| // Prepare the resolved units.
|
| - List<CompilationUnit> units;
|
| + CompilationUnit unit;
|
| if (server.options.enableNewAnalysisDriver) {
|
| AnalysisResult result = await server.getAnalysisResult(params.file);
|
| - units = result != null ? [result.unit] : null;
|
| + unit = result?.unit;
|
| } else {
|
| - units = server.getResolvedCompilationUnits(params.file);
|
| + unit = server.getResolvedCompilationUnit(params.file);
|
| }
|
|
|
| // Prepare the hovers.
|
| List<HoverInformation> hovers = <HoverInformation>[];
|
| - for (CompilationUnit unit in units) {
|
| + if (unit != null) {
|
| HoverInformation hoverInformation =
|
| new DartUnitHoverComputer(unit, params.offset).compute();
|
| if (hoverInformation != null) {
|
| @@ -147,12 +147,11 @@ class AnalysisDomainHandler implements RequestHandler {
|
| analysisFuture.then((AnalysisDoneReason reason) {
|
| switch (reason) {
|
| case AnalysisDoneReason.COMPLETE:
|
| - List<CompilationUnit> units =
|
| - server.getResolvedCompilationUnits(file);
|
| - if (units.isEmpty) {
|
| + CompilationUnit unit = server.getResolvedCompilationUnit(file);
|
| + if (unit == null) {
|
| server.sendResponse(new Response.getNavigationInvalidFile(request));
|
| } else {
|
| - CompilationUnitElement unitElement = units.first.element;
|
| + CompilationUnitElement unitElement = unit.element;
|
| NavigationCollectorImpl collector = computeNavigation(
|
| server,
|
| unitElement.context,
|
|
|