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

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

Issue 630863003: Stop sending launchData for non-analyzed files (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 domain.execution; 5 library domain.execution;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 onFileAnalyzed.cancel(); 135 onFileAnalyzed.cancel();
136 onFileAnalyzed = null; 136 onFileAnalyzed = null;
137 } 137 }
138 } 138 }
139 return new ExecutionSetSubscriptionsResult().toResponse(request.id); 139 return new ExecutionSetSubscriptionsResult().toResponse(request.id);
140 } 140 }
141 141
142 void _fileAnalyzed(ChangeNotice notice) { 142 void _fileAnalyzed(ChangeNotice notice) {
143 Source source = notice.source; 143 Source source = notice.source;
144 String filePath = source.fullName; 144 String filePath = source.fullName;
145 if (!server.contextDirectoryManager.isInAnalysisRoot(filePath)) {
scheglov 2014/10/06 16:51:44 You could extract "server.contextDirectoryManager.
Brian Wilkerson 2014/10/06 18:56:20 Done
146 return;
147 }
145 AnalysisContext context = server.getAnalysisContext(filePath); 148 AnalysisContext context = server.getAnalysisContext(filePath);
146 if (AnalysisEngine.isDartFileName(filePath)) { 149 if (AnalysisEngine.isDartFileName(filePath)) {
147 ExecutableKind kind = ExecutableKind.NOT_EXECUTABLE; 150 ExecutableKind kind = ExecutableKind.NOT_EXECUTABLE;
148 if (context.isClientLibrary(source)) { 151 if (context.isClientLibrary(source)) {
149 kind = ExecutableKind.CLIENT; 152 kind = ExecutableKind.CLIENT;
150 if (context.isServerLibrary(source)) { 153 if (context.isServerLibrary(source)) {
151 kind = ExecutableKind.EITHER; 154 kind = ExecutableKind.EITHER;
152 } 155 }
153 } else if (context.isServerLibrary(source)) { 156 } else if (context.isServerLibrary(source)) {
154 kind = ExecutableKind.SERVER; 157 kind = ExecutableKind.SERVER;
(...skipping 12 matching lines...) Expand all
167 } 170 }
168 171
169 void _reportCurrentFileStatus() { 172 void _reportCurrentFileStatus() {
170 Map<String, List<String>> dartToHtml = new HashMap<String, List<String>>(); 173 Map<String, List<String>> dartToHtml = new HashMap<String, List<String>>();
171 Map<String, List<String>> htmlToDart = new HashMap<String, List<String>>(); 174 Map<String, List<String>> htmlToDart = new HashMap<String, List<String>>();
172 for (AnalysisContext context in server.getAnalysisContexts()) { 175 for (AnalysisContext context in server.getAnalysisContexts()) {
173 List<Source> librarySources = context.librarySources; 176 List<Source> librarySources = context.librarySources;
174 List<Source> clientSources = context.launchableClientLibrarySources; 177 List<Source> clientSources = context.launchableClientLibrarySources;
175 List<Source> serverSources = context.launchableServerLibrarySources; 178 List<Source> serverSources = context.launchableServerLibrarySources;
176 for (Source source in clientSources) { 179 for (Source source in clientSources) {
180 String filePath = source.fullName;
177 if (serverSources.remove(source)) { 181 if (serverSources.remove(source)) {
178 server.sendNotification( 182 if (server.contextDirectoryManager.isInAnalysisRoot(filePath)) {
179 new ExecutionLaunchDataParams( 183 server.sendNotification(
180 source.fullName, 184 new ExecutionLaunchDataParams(
181 kind: ExecutableKind.EITHER).toNotification()); 185 filePath,
186 kind: ExecutableKind.EITHER).toNotification());
187 }
scheglov 2014/10/06 16:51:44 The whole "if" statement could be extracted into a
Brian Wilkerson 2014/10/06 18:56:20 Done
182 } else { 188 } else {
183 server.sendNotification( 189 if (server.contextDirectoryManager.isInAnalysisRoot(filePath)) {
184 new ExecutionLaunchDataParams( 190 server.sendNotification(
185 source.fullName, 191 new ExecutionLaunchDataParams(
186 kind: ExecutableKind.CLIENT).toNotification()); 192 filePath,
193 kind: ExecutableKind.CLIENT).toNotification());
194 }
187 } 195 }
188 librarySources.remove(source); 196 librarySources.remove(source);
189 } 197 }
190 for (Source source in serverSources) { 198 for (Source source in serverSources) {
191 server.sendNotification( 199 String filePath = source.fullName;
192 new ExecutionLaunchDataParams( 200 if (server.contextDirectoryManager.isInAnalysisRoot(filePath)) {
193 source.fullName, 201 server.sendNotification(
194 kind: ExecutableKind.SERVER).toNotification()); 202 new ExecutionLaunchDataParams(
203 filePath,
204 kind: ExecutableKind.SERVER).toNotification());
205 }
195 librarySources.remove(source); 206 librarySources.remove(source);
196 } 207 }
197 for (Source source in librarySources) { 208 for (Source source in librarySources) {
198 server.sendNotification( 209 String filePath = source.fullName;
199 new ExecutionLaunchDataParams( 210 if (server.contextDirectoryManager.isInAnalysisRoot(filePath)) {
200 source.fullName, 211 server.sendNotification(
201 kind: ExecutableKind.NOT_EXECUTABLE).toNotification()); 212 new ExecutionLaunchDataParams(
213 filePath,
214 kind: ExecutableKind.NOT_EXECUTABLE).toNotification());
215 }
202 } 216 }
203 for (Source source in context.htmlSources) { 217 for (Source source in context.htmlSources) {
204 List<Source> libraries = context.getLibrariesReferencedFromHtml(source); 218 String filePath = source.fullName;
205 server.sendNotification( 219 if (server.contextDirectoryManager.isInAnalysisRoot(filePath)) {
206 new ExecutionLaunchDataParams( 220 List<Source> libraries = context.getLibrariesReferencedFromHtml(source );
207 source.fullName, 221 server.sendNotification(
208 referencedFiles: _getFullNames(libraries)).toNotification()); 222 new ExecutionLaunchDataParams(
223 filePath,
224 referencedFiles: _getFullNames(libraries)).toNotification());
225 }
209 } 226 }
210 } 227 }
211 } 228 }
212 229
213 static List<String> _getFullNames(List<Source> sources) { 230 static List<String> _getFullNames(List<Source> sources) {
214 return sources.map((Source source) => source.fullName).toList(); 231 return sources.map((Source source) => source.fullName).toList();
215 } 232 }
216 } 233 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698