| 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; | |
| 6 | |
| 7 import 'dart:async'; | 5 import 'dart:async'; |
| 8 import 'dart:core'; | 6 import 'dart:core'; |
| 9 import 'dart:math' as math; | 7 import 'dart:math' as math; |
| 10 | 8 |
| 11 import 'package:analysis_server/src/context_manager.dart'; | 9 import 'package:analysis_server/src/context_manager.dart'; |
| 12 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| 13 import 'package:analyzer/plugin/resolver_provider.dart'; | 11 import 'package:analyzer/plugin/resolver_provider.dart'; |
| 14 import 'package:analyzer/src/dart/analysis/driver.dart'; | 12 import 'package:analyzer/src/dart/analysis/driver.dart'; |
| 15 import 'package:analyzer/src/generated/engine.dart'; | 13 import 'package:analyzer/src/generated/engine.dart'; |
| 16 import 'package:analyzer/src/generated/sdk.dart'; | 14 import 'package:analyzer/src/generated/sdk.dart'; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 128 |
| 131 @override | 129 @override |
| 132 List<AnalysisContext> contextsInAnalysisRoot(Folder analysisRoot) { | 130 List<AnalysisContext> contextsInAnalysisRoot(Folder analysisRoot) { |
| 133 if (context == null || !includedPaths.contains(analysisRoot.path)) { | 131 if (context == null || !includedPaths.contains(analysisRoot.path)) { |
| 134 return <AnalysisContext>[]; | 132 return <AnalysisContext>[]; |
| 135 } | 133 } |
| 136 return <AnalysisContext>[context]; | 134 return <AnalysisContext>[context]; |
| 137 } | 135 } |
| 138 | 136 |
| 139 @override | 137 @override |
| 138 Folder getContextFolderFor(String path) { |
| 139 if (isInAnalysisRoot(path)) { |
| 140 return contextFolder; |
| 141 } |
| 142 return null; |
| 143 } |
| 144 |
| 145 @override |
| 140 AnalysisContext getContextFor(String path) { | 146 AnalysisContext getContextFor(String path) { |
| 141 if (context == null) { | 147 if (context == null) { |
| 142 return null; | 148 return null; |
| 143 } else if (_isContainedIn(includedPaths, path)) { | 149 } else if (_isContainedIn(includedPaths, path)) { |
| 144 return context; | 150 return context; |
| 145 } | 151 } |
| 146 return null; | 152 return null; |
| 147 } | 153 } |
| 148 | |
| 149 @override | |
| 150 Folder getContextFolderFor(String path) { | |
| 151 if (isInAnalysisRoot(path)) { | |
| 152 return contextFolder; | |
| 153 } | |
| 154 return null; | |
| 155 } | |
| 156 | 154 |
| 157 @override | 155 @override |
| 158 AnalysisDriver getDriverFor(String path) { | 156 AnalysisDriver getDriverFor(String path) { |
| 159 throw new UnimplementedError( | 157 throw new UnimplementedError( |
| 160 'Unexpected invocation of getDriverFor in SingleContextManager'); | 158 'Unexpected invocation of getDriverFor in SingleContextManager'); |
| 161 } | 159 } |
| 162 | 160 |
| 163 @override | 161 @override |
| 164 List<AnalysisDriver> getDriversInAnalysisRoot(Folder analysisRoot) { | 162 List<AnalysisDriver> getDriversInAnalysisRoot(Folder analysisRoot) { |
| 165 throw new UnimplementedError( | 163 throw new UnimplementedError( |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 static List<Resource> _getChildrenSafe(Folder folder) { | 524 static List<Resource> _getChildrenSafe(Folder folder) { |
| 527 try { | 525 try { |
| 528 return folder.getChildren(); | 526 return folder.getChildren(); |
| 529 } on FileSystemException { | 527 } on FileSystemException { |
| 530 // The folder either doesn't exist or cannot be read. | 528 // The folder either doesn't exist or cannot be read. |
| 531 // Either way, there are no children. | 529 // Either way, there are no children. |
| 532 return const <Resource>[]; | 530 return const <Resource>[]; |
| 533 } | 531 } |
| 534 } | 532 } |
| 535 } | 533 } |
| OLD | NEW |