Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: pkg/analysis_server/lib/src/domain_analysis.dart

Issue 407443002: Fix analysis server 'analysis.getHover' when there is no hover information. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis_hover_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis_hover_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698