| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 domain.analysis; | 5 library domain.analysis; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/analysis_server.dart'; | 9 import 'package:analysis_server/src/analysis_server.dart'; |
| 10 import 'package:analysis_server/src/constants.dart'; | 10 import 'package:analysis_server/src/constants.dart'; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 * Implement the `analysis.getHover` request. | 32 * Implement the `analysis.getHover` request. |
| 33 */ | 33 */ |
| 34 Response getAnalysisHover(Request request) { | 34 Response getAnalysisHover(Request request) { |
| 35 // prepare parameters | 35 // prepare parameters |
| 36 String file = request.getRequiredParameter(FILE).asString(); | 36 String file = request.getRequiredParameter(FILE).asString(); |
| 37 int offset = request.getRequiredParameter(OFFSET).asInt(); | 37 int offset = request.getRequiredParameter(OFFSET).asInt(); |
| 38 // prepare hovers | 38 // prepare hovers |
| 39 List<Hover> hovers = <Hover>[]; | 39 List<Hover> hovers = <Hover>[]; |
| 40 List<CompilationUnit> units = server.getResolvedCompilationUnits(file); | 40 List<CompilationUnit> units = server.getResolvedCompilationUnits(file); |
| 41 for (CompilationUnit unit in units) { | 41 for (CompilationUnit unit in units) { |
| 42 hovers.add(new DartUnitHoverComputer(unit, offset).compute()); | 42 Hover hoverInformation = new DartUnitHoverComputer(unit, offset).compute()
; |
| 43 if (hoverInformation != null) { |
| 44 hovers.add(hoverInformation); |
| 45 } |
| 43 } | 46 } |
| 44 // send response | 47 // send response |
| 45 Response response = new Response(request.id); | 48 Response response = new Response(request.id); |
| 46 response.setResult(HOVERS, hovers); | 49 response.setResult(HOVERS, hovers); |
| 47 return response; | 50 return response; |
| 48 } | 51 } |
| 49 | 52 |
| 50 @override | 53 @override |
| 51 Response handleRequest(Request request) { | 54 Response handleRequest(Request request) { |
| 52 try { | 55 try { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 221 |
| 219 /** | 222 /** |
| 220 * A description of the change to the content of a file. | 223 * A description of the change to the content of a file. |
| 221 */ | 224 */ |
| 222 class ContentChange { | 225 class ContentChange { |
| 223 String content; | 226 String content; |
| 224 int offset; | 227 int offset; |
| 225 int oldLength; | 228 int oldLength; |
| 226 int newLength; | 229 int newLength; |
| 227 } | 230 } |
| OLD | NEW |