| Index: pkg/analysis_server/lib/src/context_manager.dart
|
| diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
|
| index 6f815d17c52df1ccd4c92140769c14a7d0de09ce..02ac2199b521424fee053906a673d3e48b7afc20 100644
|
| --- a/pkg/analysis_server/lib/src/context_manager.dart
|
| +++ b/pkg/analysis_server/lib/src/context_manager.dart
|
| @@ -11,23 +11,23 @@ import 'package:analyzer/file_system/file_system.dart';
|
| import 'package:analyzer/source/package_map_provider.dart';
|
| import 'package:analyzer/source/package_map_resolver.dart';
|
| import 'package:analyzer/src/generated/engine.dart';
|
| +import 'package:analyzer/src/generated/java_io.dart';
|
| import 'package:analyzer/src/generated/source.dart';
|
| import 'package:analyzer/src/generated/source_io.dart';
|
| -import 'package:analyzer/src/generated/java_io.dart';
|
| import 'package:path/path.dart' as pathos;
|
| import 'package:watcher/watcher.dart';
|
|
|
|
|
| /**
|
| - * File name of pubspec files.
|
| + * The name of `packages` folders.
|
| */
|
| -const String PUBSPEC_NAME = 'pubspec.yaml';
|
| +const String PACKAGES_NAME = 'packages';
|
|
|
|
|
| /**
|
| - * The name of `packages` folders.
|
| + * File name of pubspec files.
|
| */
|
| -const String PACKAGES_NAME = 'packages';
|
| +const String PUBSPEC_NAME = 'pubspec.yaml';
|
|
|
|
|
| /**
|
| @@ -116,11 +116,6 @@ abstract class ContextManager {
|
| }
|
|
|
| /**
|
| - * Remove the context associated with the given [folder].
|
| - */
|
| - void removeContext(Folder folder);
|
| -
|
| - /**
|
| * Rebuild the set of contexts from scratch based on the data last sent to
|
| * setRoots().
|
| */
|
| @@ -134,6 +129,11 @@ abstract class ContextManager {
|
| }
|
|
|
| /**
|
| + * Remove the context associated with the given [folder].
|
| + */
|
| + void removeContext(Folder folder);
|
| +
|
| + /**
|
| * Change the set of paths which should be used as starting points to
|
| * determine the context directories.
|
| */
|
| @@ -226,7 +226,7 @@ abstract class ContextManager {
|
| * Called when the package map for a context has changed.
|
| */
|
| void updateContextPackageUriResolver(Folder contextFolder,
|
| - UriResolver packageUriResolver);
|
| + UriResolver packageUriResolver);
|
|
|
| /**
|
| * Resursively adds all Dart and HTML files to the [changeSet].
|
| @@ -303,14 +303,14 @@ abstract class ContextManager {
|
| UriResolver packageUriResolver;
|
| if (info.packageRoot != null) {
|
| info.packageMapDependencies = new Set<String>();
|
| - packageUriResolver = new PackageUriResolver(
|
| - [new JavaFile(info.packageRoot)]);
|
| + packageUriResolver =
|
| + new PackageUriResolver([new JavaFile(info.packageRoot)]);
|
| } else {
|
| PackageMapInfo packageMapInfo =
|
| _packageMapProvider.computePackageMap(folder);
|
| info.packageMapDependencies = packageMapInfo.dependencies;
|
| - packageUriResolver = new PackageMapUriResolver(
|
| - resourceProvider, packageMapInfo.packageMap);
|
| + packageUriResolver =
|
| + new PackageMapUriResolver(resourceProvider, packageMapInfo.packageMap);
|
| // TODO(paulberry): if any of the dependencies is outside of [folder],
|
| // we'll need to watch their parent folders as well.
|
| }
|
| @@ -321,8 +321,8 @@ abstract class ContextManager {
|
| * Create a new empty context associated with [folder].
|
| */
|
| _ContextInfo _createContext(Folder folder, List<_ContextInfo> children) {
|
| - _ContextInfo info = new _ContextInfo(folder, children,
|
| - normalizedPackageRoots[folder.path]);
|
| + _ContextInfo info =
|
| + new _ContextInfo(folder, children, normalizedPackageRoots[folder.path]);
|
| _contexts[folder] = info;
|
| info.changeSubscription = folder.changes.listen((WatchEvent event) {
|
| _handleWatchEvent(folder, info, event);
|
| @@ -333,18 +333,6 @@ abstract class ContextManager {
|
| }
|
|
|
| /**
|
| - * Create a new context associated with [folder] and fills its with sources.
|
| - */
|
| - _ContextInfo _createContextWithSources(Folder folder,
|
| - List<_ContextInfo> children) {
|
| - _ContextInfo info = _createContext(folder, children);
|
| - ChangeSet changeSet = new ChangeSet();
|
| - _addSourceFiles(changeSet, folder, info);
|
| - applyChangesToContext(folder, changeSet);
|
| - return info;
|
| - }
|
| -
|
| - /**
|
| * Creates a new context associated with [folder].
|
| *
|
| * If there are subfolders with 'pubspec.yaml' files, separate contexts
|
| @@ -385,6 +373,18 @@ abstract class ContextManager {
|
| }
|
|
|
| /**
|
| + * Create a new context associated with [folder] and fills its with sources.
|
| + */
|
| + _ContextInfo _createContextWithSources(Folder folder,
|
| + List<_ContextInfo> children) {
|
| + _ContextInfo info = _createContext(folder, children);
|
| + ChangeSet changeSet = new ChangeSet();
|
| + _addSourceFiles(changeSet, folder, info);
|
| + applyChangesToContext(folder, changeSet);
|
| + return info;
|
| + }
|
| +
|
| + /**
|
| * Clean up and destroy the context associated with the given folder.
|
| */
|
| void _destroyContext(Folder folder) {
|
|
|