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

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

Issue 396453004: Handle context == null in the analysis.getHover request. (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 23 matching lines...) Expand all
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<Map<String, Object>> hovers = <Map<String, Object>>[]; 40 List<Map<String, Object>> hovers = <Map<String, Object>>[];
41 { 41 {
42 Source source = server.getSource(file); 42 Source source = server.getSource(file);
43 AnalysisContext context = server.getAnalysisContext(file); 43 AnalysisContext context = server.getAnalysisContext(file);
44 List<Source> librarySources = context.getLibrariesContaining(source); 44 if (context != null) {
45 for (Source librarySource in librarySources) { 45 List<Source> librarySources = context.getLibrariesContaining(source);
46 CompilationUnit unit = context.resolveCompilationUnit2(source, 46 for (Source librarySource in librarySources) {
47 librarySource); 47 CompilationUnit unit = context.resolveCompilationUnit2(source,
48 hovers.add(new DartUnitHoverComputer(unit, offset).compute()); 48 librarySource);
49 hovers.add(new DartUnitHoverComputer(unit, offset).compute());
50 }
49 } 51 }
50 } 52 }
51 // send response 53 // send response
52 Response response = new Response(request.id); 54 Response response = new Response(request.id);
53 response.setResult(HOVERS, hovers); 55 response.setResult(HOVERS, hovers);
54 return response; 56 return response;
55 } 57 }
56 58
57 @override 59 @override
58 Response handleRequest(Request request) { 60 Response handleRequest(Request request) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 227
226 /** 228 /**
227 * A description of the change to the content of a file. 229 * A description of the change to the content of a file.
228 */ 230 */
229 class ContentChange { 231 class ContentChange {
230 String content; 232 String content;
231 int offset; 233 int offset;
232 int oldLength; 234 int oldLength;
233 int newLength; 235 int newLength;
234 } 236 }
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