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

Side by Side Diff: pkg/analysis_server/lib/src/operation/operation_analysis.dart

Issue 367973006: Implementation for 'analysis.occurrences' notification. (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
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 operation.analysis; 5 library operation.analysis;
6 6
7 import 'package:analysis_server/src/analysis_server.dart'; 7 import 'package:analysis_server/src/analysis_server.dart';
8 import 'package:analysis_server/src/computer/computer_highlights.dart'; 8 import 'package:analysis_server/src/computer/computer_highlights.dart';
9 import 'package:analysis_server/src/computer/computer_navigation.dart'; 9 import 'package:analysis_server/src/computer/computer_navigation.dart';
10 import 'package:analysis_server/src/computer/computer_occurrences.dart';
10 import 'package:analysis_server/src/computer/computer_outline.dart'; 11 import 'package:analysis_server/src/computer/computer_outline.dart';
11 import 'package:analysis_server/src/constants.dart'; 12 import 'package:analysis_server/src/constants.dart';
12 import 'package:analysis_server/src/operation/operation.dart'; 13 import 'package:analysis_server/src/operation/operation.dart';
13 import 'package:analysis_server/src/protocol.dart'; 14 import 'package:analysis_server/src/protocol.dart';
14 import 'package:analyzer/src/generated/ast.dart'; 15 import 'package:analyzer/src/generated/ast.dart';
15 import 'package:analyzer/src/generated/engine.dart'; 16 import 'package:analyzer/src/generated/engine.dart';
16 import 'package:analyzer/src/generated/error.dart'; 17 import 'package:analyzer/src/generated/error.dart';
17 import 'package:analyzer/src/generated/html.dart'; 18 import 'package:analyzer/src/generated/html.dart';
18 import 'package:analyzer/src/generated/index.dart'; 19 import 'package:analyzer/src/generated/index.dart';
19 import 'package:analyzer/src/generated/java_core.dart'; 20 import 'package:analyzer/src/generated/java_core.dart';
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void sendAnalysisNotificationNavigation(AnalysisServer server, String file, 78 void sendAnalysisNotificationNavigation(AnalysisServer server, String file,
78 CompilationUnit dartUnit) { 79 CompilationUnit dartUnit) {
79 Notification notification = new Notification(ANALYSIS_NAVIGATION); 80 Notification notification = new Notification(ANALYSIS_NAVIGATION);
80 notification.setParameter(FILE, file); 81 notification.setParameter(FILE, file);
81 notification.setParameter(REGIONS, new DartUnitNavigationComputer( 82 notification.setParameter(REGIONS, new DartUnitNavigationComputer(
82 dartUnit).compute()); 83 dartUnit).compute());
83 server.sendNotification(notification); 84 server.sendNotification(notification);
84 } 85 }
85 86
86 87
88 void sendAnalysisNotificationOccurrences(AnalysisServer server, String file,
89 CompilationUnit dartUnit) {
90 Notification notification = new Notification(ANALYSIS_OCCURRENCES);
91 notification.setParameter(FILE, file);
92 notification.setParameter(OCCURRENCES, new DartUnitOccurrencesComputer(
93 dartUnit).compute());
94 server.sendNotification(notification);
95 }
96
97
87 void sendAnalysisNotificationOutline(AnalysisServer server, 98 void sendAnalysisNotificationOutline(AnalysisServer server,
88 AnalysisContext context, Source source, CompilationUnit dartUnit) { 99 AnalysisContext context, Source source, CompilationUnit dartUnit) {
89 Notification notification = new Notification(ANALYSIS_OUTLINE); 100 Notification notification = new Notification(ANALYSIS_OUTLINE);
90 notification.setParameter(FILE, source.fullName); 101 notification.setParameter(FILE, source.fullName);
91 notification.setParameter(OUTLINE, new DartUnitOutlineComputer(context, 102 notification.setParameter(OUTLINE, new DartUnitOutlineComputer(context,
92 source, dartUnit).compute()); 103 source, dartUnit).compute());
93 server.sendNotification(notification); 104 server.sendNotification(notification);
94 } 105 }
95 106
96 107
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 String file = source.fullName; 156 String file = source.fullName;
146 // Dart 157 // Dart
147 CompilationUnit dartUnit = notice.compilationUnit; 158 CompilationUnit dartUnit = notice.compilationUnit;
148 if (dartUnit != null) { 159 if (dartUnit != null) {
149 if (server.hasAnalysisSubscription(AnalysisService.HIGHLIGHTS, file)) { 160 if (server.hasAnalysisSubscription(AnalysisService.HIGHLIGHTS, file)) {
150 sendAnalysisNotificationHighlights(server, file, dartUnit); 161 sendAnalysisNotificationHighlights(server, file, dartUnit);
151 } 162 }
152 if (server.hasAnalysisSubscription(AnalysisService.NAVIGATION, file)) { 163 if (server.hasAnalysisSubscription(AnalysisService.NAVIGATION, file)) {
153 sendAnalysisNotificationNavigation(server, file, dartUnit); 164 sendAnalysisNotificationNavigation(server, file, dartUnit);
154 } 165 }
166 if (server.hasAnalysisSubscription(AnalysisService.OCCURRENCES, file)) {
167 sendAnalysisNotificationOccurrences(server, file, dartUnit);
168 }
155 if (server.hasAnalysisSubscription(AnalysisService.OUTLINE, file)) { 169 if (server.hasAnalysisSubscription(AnalysisService.OUTLINE, file)) {
156 sendAnalysisNotificationOutline(server, context, source, dartUnit); 170 sendAnalysisNotificationOutline(server, context, source, dartUnit);
157 } 171 }
158 } 172 }
159 // TODO(scheglov) use default subscriptions 173 // TODO(scheglov) use default subscriptions
160 if (!source.isInSystemLibrary) { 174 if (!source.isInSystemLibrary) {
161 sendAnalysisNotificationErrors(server, file, notice.lineInfo, 175 sendAnalysisNotificationErrors(server, file, notice.lineInfo,
162 notice.errors); 176 notice.errors);
163 } 177 }
164 } 178 }
(...skipping 14 matching lines...) Expand all
179 // HTML 193 // HTML
180 { 194 {
181 HtmlUnit htmlUnit = notice.htmlUnit; 195 HtmlUnit htmlUnit = notice.htmlUnit;
182 if (htmlUnit != null) { 196 if (htmlUnit != null) {
183 index.indexHtmlUnit(context, htmlUnit); 197 index.indexHtmlUnit(context, htmlUnit);
184 } 198 }
185 } 199 }
186 } 200 }
187 } 201 }
188 } 202 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/constants.dart ('k') | pkg/analysis_server/test/analysis_notification_occurrences_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698