| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 analysis_server.src.single_context_manager; | 5 library analysis_server.src.single_context_manager; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:core'; | 8 import 'dart:core'; |
| 9 import 'dart:math' as math; | 9 import 'dart:math' as math; |
| 10 | 10 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 193 } |
| 194 // Remember the subscription. | 194 // Remember the subscription. |
| 195 newSubscriptions[includedPath] = subscription; | 195 newSubscriptions[includedPath] = subscription; |
| 196 } | 196 } |
| 197 _cancelCurrentWatchSubscriptions(); | 197 _cancelCurrentWatchSubscriptions(); |
| 198 this.watchSubscriptions = newSubscriptions; | 198 this.watchSubscriptions = newSubscriptions; |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 // Create or update the analysis context. | 201 // Create or update the analysis context. |
| 202 if (context == null) { | 202 if (context == null) { |
| 203 UriResolver packageResolver = packageResolverProvider(contextFolder); | 203 context = callbacks.addContext(contextFolder, defaultContextOptions); |
| 204 context = callbacks.addContext(contextFolder, defaultContextOptions, | |
| 205 new CustomPackageResolverDisposition(packageResolver)); | |
| 206 ChangeSet changeSet = | 204 ChangeSet changeSet = |
| 207 _buildChangeSet(added: _includedFiles(includedPaths, excludedPaths)); | 205 _buildChangeSet(added: _includedFiles(includedPaths, excludedPaths)); |
| 208 callbacks.applyChangesToContext(contextFolder, changeSet); | 206 callbacks.applyChangesToContext(contextFolder, changeSet); |
| 209 } else { | 207 } else { |
| 210 // TODO(brianwilkerson) Optimize this. | 208 // TODO(brianwilkerson) Optimize this. |
| 211 List<File> oldFiles = | 209 List<File> oldFiles = |
| 212 _includedFiles(this.includedPaths, this.excludedPaths); | 210 _includedFiles(this.includedPaths, this.excludedPaths); |
| 213 List<File> newFiles = _includedFiles(includedPaths, excludedPaths); | 211 List<File> newFiles = _includedFiles(includedPaths, excludedPaths); |
| 214 ChangeSet changeSet = _buildChangeSet( | 212 ChangeSet changeSet = _buildChangeSet( |
| 215 added: _diff(newFiles, oldFiles), removed: _diff(oldFiles, newFiles)); | 213 added: _diff(newFiles, oldFiles), removed: _diff(oldFiles, newFiles)); |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 static List<Resource> _getChildrenSafe(Folder folder) { | 497 static List<Resource> _getChildrenSafe(Folder folder) { |
| 500 try { | 498 try { |
| 501 return folder.getChildren(); | 499 return folder.getChildren(); |
| 502 } on FileSystemException { | 500 } on FileSystemException { |
| 503 // The folder either doesn't exist or cannot be read. | 501 // The folder either doesn't exist or cannot be read. |
| 504 // Either way, there are no children. | 502 // Either way, there are no children. |
| 505 return const <Resource>[]; | 503 return const <Resource>[]; |
| 506 } | 504 } |
| 507 } | 505 } |
| 508 } | 506 } |
| OLD | NEW |