| 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 analysis.server; | 5 library analysis.server; |
| 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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 return folderMap.values; | 677 return folderMap.values; |
| 678 } | 678 } |
| 679 | 679 |
| 680 /** | 680 /** |
| 681 * Return the [AnalysisContext] that is used to analyze the given [path]. | 681 * Return the [AnalysisContext] that is used to analyze the given [path]. |
| 682 * Return `null` if there is no such context. | 682 * Return `null` if there is no such context. |
| 683 */ | 683 */ |
| 684 AnalysisContext getAnalysisContext(String path) { | 684 AnalysisContext getAnalysisContext(String path) { |
| 685 // try to find a containing context | 685 // try to find a containing context |
| 686 for (Folder folder in folderMap.keys) { | 686 for (Folder folder in folderMap.keys) { |
| 687 if (path.startsWith(folder.path)) { | 687 if (folder.contains(path)) { |
| 688 return folderMap[folder]; | 688 return folderMap[folder]; |
| 689 } | 689 } |
| 690 } | 690 } |
| 691 // check if there is a context that analyzed this source | 691 // check if there is a context that analyzed this source |
| 692 Source source = getSource(path); | 692 Source source = getSource(path); |
| 693 for (AnalysisContext context in folderMap.values) { | 693 for (AnalysisContext context in folderMap.values) { |
| 694 SourceKind kind = context.getKindOf(source); | 694 SourceKind kind = context.getKindOf(source); |
| 695 if (kind != null) { | 695 if (kind != null) { |
| 696 return context; | 696 return context; |
| 697 } | 697 } |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 // send the notification | 933 // send the notification |
| 934 channel.sendNotification( | 934 channel.sendNotification( |
| 935 new ServerErrorParams( | 935 new ServerErrorParams( |
| 936 true, | 936 true, |
| 937 exceptionString, | 937 exceptionString, |
| 938 stackTraceString).toNotification()); | 938 stackTraceString).toNotification()); |
| 939 } | 939 } |
| 940 } | 940 } |
| 941 | 941 |
| 942 typedef void OptionUpdater(AnalysisOptionsImpl options); | 942 typedef void OptionUpdater(AnalysisOptionsImpl options); |
| OLD | NEW |