| 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:analysis_server/src/analysis_server.dart'; | 10 import 'package:analysis_server/src/analysis_server.dart'; |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 * Create and return a source representing the given [file] within the given | 605 * Create and return a source representing the given [file] within the given |
| 606 * [context]. | 606 * [context]. |
| 607 */ | 607 */ |
| 608 static Source createSourceInContext(AnalysisContext context, File file) { | 608 static Source createSourceInContext(AnalysisContext context, File file) { |
| 609 // TODO(brianwilkerson) Optimize this, by allowing support for source | 609 // TODO(brianwilkerson) Optimize this, by allowing support for source |
| 610 // factories to restore URI's from a file path rather than a source. | 610 // factories to restore URI's from a file path rather than a source. |
| 611 Source source = file.createSource(); | 611 Source source = file.createSource(); |
| 612 if (context == null) { | 612 if (context == null) { |
| 613 return source; | 613 return source; |
| 614 } | 614 } |
| 615 if (context.sourceFactory == null) { |
| 616 return null; |
| 617 } |
| 615 Uri uri = context.sourceFactory.restoreUri(source); | 618 Uri uri = context.sourceFactory.restoreUri(source); |
| 616 return file.createSource(uri); | 619 return file.createSource(uri); |
| 617 } | 620 } |
| 618 | 621 |
| 619 static bool _shouldFileBeAnalyzed(File file) { | 622 static bool _shouldFileBeAnalyzed(File file) { |
| 620 if (!(AnalysisEngine.isDartFileName(file.path) || | 623 if (!(AnalysisEngine.isDartFileName(file.path) || |
| 621 AnalysisEngine.isHtmlFileName(file.path))) { | 624 AnalysisEngine.isHtmlFileName(file.path))) { |
| 622 return false; | 625 return false; |
| 623 } | 626 } |
| 624 // Emacs creates dummy links to track the fact that a file is open for | 627 // Emacs creates dummy links to track the fact that a file is open for |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 return excludes(resource.path); | 713 return excludes(resource.path); |
| 711 } | 714 } |
| 712 | 715 |
| 713 /** | 716 /** |
| 714 * Returns `true` if [path] is the pubspec file of this context. | 717 * Returns `true` if [path] is the pubspec file of this context. |
| 715 */ | 718 */ |
| 716 bool isPubspec(String path) { | 719 bool isPubspec(String path) { |
| 717 return path == pubspecPath; | 720 return path == pubspecPath; |
| 718 } | 721 } |
| 719 } | 722 } |
| OLD | NEW |