Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 context.directory.manager; | 5 library context.directory.manager; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 } | 234 } |
| 235 // Emacs creates dummy links to track the fact that a file is open for | 235 // Emacs creates dummy links to track the fact that a file is open for |
| 236 // editing and has unsaved changes (e.g. having unsaved changes to | 236 // editing and has unsaved changes (e.g. having unsaved changes to |
| 237 // 'foo.dart' causes a link '.#foo.dart' to be created, which points to the | 237 // 'foo.dart' causes a link '.#foo.dart' to be created, which points to the |
| 238 // non-existent file 'username@hostname.pid'. To avoid these dummy links | 238 // non-existent file 'username@hostname.pid'. To avoid these dummy links |
| 239 // causing the analyzer to thrash, just ignore links to non-existent files. | 239 // causing the analyzer to thrash, just ignore links to non-existent files. |
| 240 return file.exists; | 240 return file.exists; |
| 241 } | 241 } |
| 242 | 242 |
| 243 /** | 243 /** |
| 244 * Returns `true` if the given absolute [path] is in one of the current | |
| 245 * root folders and is not excluded. | |
| 246 */ | |
| 247 bool isInAnalysisRoot(String path) { | |
|
Brian Wilkerson
2014/08/06 19:40:43
This doesn't look like it's taking care of exclude
scheglov
2014/08/06 19:58:04
Thanks, I was going to add TODO, but forgot.
Done.
| |
| 248 for (Folder root in _currentDirectoryInfo.keys) { | |
| 249 if (path.startsWith(root.path)) { | |
| 250 return true; | |
| 251 } | |
| 252 } | |
| 253 return false; | |
| 254 } | |
| 255 | |
| 256 /** | |
| 244 * Called when a new context needs to be created. | 257 * Called when a new context needs to be created. |
| 245 */ | 258 */ |
| 246 void addContext(Folder folder, Map<String, List<Folder>> packageMap); | 259 void addContext(Folder folder, Map<String, List<Folder>> packageMap); |
| 247 | 260 |
| 248 /** | 261 /** |
| 249 * Called when the set of files associated with a context have changed (or | 262 * Called when the set of files associated with a context have changed (or |
| 250 * some of those files have been modified). [changeSet] is the set of | 263 * some of those files have been modified). [changeSet] is the set of |
| 251 * changes that need to be applied to the context. | 264 * changes that need to be applied to the context. |
| 252 */ | 265 */ |
| 253 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet); | 266 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet); |
| 254 | 267 |
| 255 /** | 268 /** |
| 256 * Remove the context associated with the given [folder]. | 269 * Remove the context associated with the given [folder]. |
| 257 */ | 270 */ |
| 258 void removeContext(Folder folder); | 271 void removeContext(Folder folder); |
| 259 | 272 |
| 260 /** | 273 /** |
| 261 * Called when the package map for a context has changed. | 274 * Called when the package map for a context has changed. |
| 262 */ | 275 */ |
| 263 void updateContextPackageMap(Folder contextFolder, | 276 void updateContextPackageMap(Folder contextFolder, |
| 264 Map<String, List<Folder>> packageMap); | 277 Map<String, List<Folder>> packageMap); |
| 265 } | 278 } |
| OLD | NEW |