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

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

Issue 1276883004: Add debug output for getNavigation(). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
« 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:async'; 7 import 'dart:async';
8 import 'dart:core' hide Resource; 8 import 'dart:core' hide Resource;
9 9
10 import 'package:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 var params = new AnalysisGetNavigationParams.fromRequest(request); 113 var params = new AnalysisGetNavigationParams.fromRequest(request);
114 String file = params.file; 114 String file = params.file;
115 Future<AnalysisDoneReason> analysisFuture = 115 Future<AnalysisDoneReason> analysisFuture =
116 server.onFileAnalysisComplete(file); 116 server.onFileAnalysisComplete(file);
117 if (analysisFuture == null) { 117 if (analysisFuture == null) {
118 return new Response.getNavigationInvalidFile(request); 118 return new Response.getNavigationInvalidFile(request);
119 } 119 }
120 analysisFuture.then((AnalysisDoneReason reason) { 120 analysisFuture.then((AnalysisDoneReason reason) {
121 switch (reason) { 121 switch (reason) {
122 case AnalysisDoneReason.COMPLETE: 122 case AnalysisDoneReason.COMPLETE:
123 print('AnalysisDoneReason.COMPLETE');
123 List<CompilationUnit> units = 124 List<CompilationUnit> units =
124 server.getResolvedCompilationUnits(file); 125 server.getResolvedCompilationUnits(file);
126 print('units: $units');
125 if (units.isEmpty) { 127 if (units.isEmpty) {
126 server.sendResponse(new Response.getNavigationInvalidFile(request)); 128 server.sendResponse(new Response.getNavigationInvalidFile(request));
127 } else { 129 } else {
128 DartUnitNavigationComputer computer = 130 DartUnitNavigationComputer computer =
129 new DartUnitNavigationComputer(); 131 new DartUnitNavigationComputer();
130 _GetNavigationAstVisitor visitor = new _GetNavigationAstVisitor( 132 _GetNavigationAstVisitor visitor = new _GetNavigationAstVisitor(
131 params.offset, params.offset + params.length, computer); 133 params.offset, params.offset + params.length, computer);
132 for (CompilationUnit unit in units) { 134 for (CompilationUnit unit in units) {
133 unit.accept(visitor); 135 unit.accept(visitor);
134 } 136 }
135 server.sendResponse(new AnalysisGetNavigationResult( 137 server.sendResponse(new AnalysisGetNavigationResult(
136 computer.files, computer.targets, computer.regions) 138 computer.files, computer.targets, computer.regions)
137 .toResponse(request.id)); 139 .toResponse(request.id));
138 } 140 }
139 break; 141 break;
140 case AnalysisDoneReason.CONTEXT_REMOVED: 142 case AnalysisDoneReason.CONTEXT_REMOVED:
143 print('AnalysisDoneReason.CONTEXT_REMOVED');
141 // The active contexts have changed, so try again. 144 // The active contexts have changed, so try again.
142 Response response = getNavigation(request); 145 Response response = getNavigation(request);
143 if (response != Response.DELAYED_RESPONSE) { 146 if (response != Response.DELAYED_RESPONSE) {
144 server.sendResponse(response); 147 server.sendResponse(response);
145 } 148 }
146 break; 149 break;
147 } 150 }
151 }).catchError((e, st) {
152 print('Exception in AnalysisDomainHandler.getNavigation()');
153 print(e);
154 print(st);
148 }); 155 });
149 // delay response 156 // delay response
150 return Response.DELAYED_RESPONSE; 157 return Response.DELAYED_RESPONSE;
151 } 158 }
152 159
153 @override 160 @override
154 Response handleRequest(Request request) { 161 Response handleRequest(Request request) {
155 try { 162 try {
156 String requestName = request.method; 163 String requestName = request.method;
157 if (requestName == ANALYSIS_GET_ERRORS) { 164 if (requestName == ANALYSIS_GET_ERRORS) {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 return; 318 return;
312 } 319 }
313 // The node starts or ends in the range. 320 // The node starts or ends in the range.
314 if (isInRange(node.offset) || isInRange(node.end)) { 321 if (isInRange(node.offset) || isInRange(node.end)) {
315 computer.compute(node); 322 computer.compute(node);
316 return; 323 return;
317 } 324 }
318 super.visitNode(node); 325 super.visitNode(node);
319 } 326 }
320 } 327 }
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