Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: pkg/analysis_server/lib/src/context_manager.dart

Issue 1188663006: watch for file system changes after context created (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import 'dart:core' hide Resource; 9 import 'dart:core' hide Resource;
10 10
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 * Create a new empty context associated with [folder]. 471 * Create a new empty context associated with [folder].
472 */ 472 */
473 _ContextInfo _createContext( 473 _ContextInfo _createContext(
474 Folder folder, File pubspecFile, List<_ContextInfo> children) { 474 Folder folder, File pubspecFile, List<_ContextInfo> children) {
475 _ContextInfo info = new _ContextInfo( 475 _ContextInfo info = new _ContextInfo(
476 folder, pubspecFile, children, normalizedPackageRoots[folder.path]); 476 folder, pubspecFile, children, normalizedPackageRoots[folder.path]);
477 _contexts[folder] = info; 477 _contexts[folder] = info;
478 info.changeSubscription = folder.changes.listen((WatchEvent event) { 478 info.changeSubscription = folder.changes.listen((WatchEvent event) {
479 _handleWatchEvent(folder, info, event); 479 _handleWatchEvent(folder, info, event);
480 }); 480 });
481 UriResolver packageUriResolver = _computePackageUriResolver(folder, info); 481 try {
482 info.context = addContext(folder, packageUriResolver); 482 UriResolver packageUriResolver = _computePackageUriResolver(folder, info);
483 info.context.name = folder.path; 483 info.context = addContext(folder, packageUriResolver);
484 info.context.name = folder.path;
485 } catch (_) {
486 info.changeSubscription.cancel();
487 rethrow;
488 }
484 return info; 489 return info;
485 } 490 }
486 491
487 /** 492 /**
488 * Potentially create a new context associated with the given [folder]. 493 * Potentially create a new context associated with the given [folder].
489 * 494 *
490 * If there are subfolders with 'pubspec.yaml' files, separate contexts are 495 * If there are subfolders with 'pubspec.yaml' files, separate contexts are
491 * created for them and excluded from the context associated with the 496 * created for them and excluded from the context associated with the
492 * [folder]. 497 * [folder].
493 * 498 *
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 return excludes(resource.path); 839 return excludes(resource.path);
835 } 840 }
836 841
837 /** 842 /**
838 * Returns `true` if [path] is the pubspec file of this context. 843 * Returns `true` if [path] is the pubspec file of this context.
839 */ 844 */
840 bool isPubspec(String path) { 845 bool isPubspec(String path) {
841 return path == pubspecPath; 846 return path == pubspecPath;
842 } 847 }
843 } 848 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698