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

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

Issue 396693003: Use AnalysisServer.getResolvedCompilationUnits() helper in hovers. (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 | no next file » | 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 20 matching lines...) Expand all
31 31
32 /** 32 /**
33 * Implement the `analysis.getHover` request. 33 * Implement the `analysis.getHover` request.
34 */ 34 */
35 Response getAnalysisHover(Request request) { 35 Response getAnalysisHover(Request request) {
36 // prepare parameters 36 // prepare parameters
37 String file = request.getRequiredParameter(FILE).asString(); 37 String file = request.getRequiredParameter(FILE).asString();
38 int offset = request.getRequiredParameter(OFFSET).asInt(); 38 int offset = request.getRequiredParameter(OFFSET).asInt();
39 // prepare hovers 39 // prepare hovers
40 List<Hover> hovers = <Hover>[]; 40 List<Hover> hovers = <Hover>[];
41 { 41 List<CompilationUnit> units = server.getResolvedCompilationUnits(file);
42 Source source = server.getSource(file); 42 for (CompilationUnit unit in units) {
43 AnalysisContext context = server.getAnalysisContext(file); 43 hovers.add(new DartUnitHoverComputer(unit, offset).compute());
44 if (context != null) {
45 List<Source> librarySources = context.getLibrariesContaining(source);
46 for (Source librarySource in librarySources) {
47 CompilationUnit unit = context.resolveCompilationUnit2(source,
48 librarySource);
49 hovers.add(new DartUnitHoverComputer(unit, offset).compute());
50 }
51 }
52 } 44 }
53 // send response 45 // send response
54 Response response = new Response(request.id); 46 Response response = new Response(request.id);
55 response.setResult(HOVERS, hovers); 47 response.setResult(HOVERS, hovers);
56 return response; 48 return response;
57 } 49 }
58 50
59 @override 51 @override
60 Response handleRequest(Request request) { 52 Response handleRequest(Request request) {
61 try { 53 try {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 219
228 /** 220 /**
229 * A description of the change to the content of a file. 221 * A description of the change to the content of a file.
230 */ 222 */
231 class ContentChange { 223 class ContentChange {
232 String content; 224 String content;
233 int offset; 225 int offset;
234 int oldLength; 226 int oldLength;
235 int newLength; 227 int newLength;
236 } 228 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698