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

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

Issue 304923003: Rename PubFolder and update comments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« 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 analysis.server; 5 library analysis.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/analysis_logger.dart'; 9 import 'package:analysis_server/src/analysis_logger.dart';
10 import 'package:analysis_server/src/channel.dart'; 10 import 'package:analysis_server/src/channel.dart';
(...skipping 17 matching lines...) Expand all
28 */ 28 */
29 final DirectoryBasedDartSdk SHARED_SDK = DirectoryBasedDartSdk.defaultSdk; 29 final DirectoryBasedDartSdk SHARED_SDK = DirectoryBasedDartSdk.defaultSdk;
30 30
31 class AnalysisServerContextDirectoryManager extends ContextDirectoryManager { 31 class AnalysisServerContextDirectoryManager extends ContextDirectoryManager {
32 final AnalysisServer analysisServer; 32 final AnalysisServer analysisServer;
33 33
34 AnalysisServerContextDirectoryManager(this.analysisServer, ResourceProvider re sourceProvider) 34 AnalysisServerContextDirectoryManager(this.analysisServer, ResourceProvider re sourceProvider)
35 : super(resourceProvider); 35 : super(resourceProvider);
36 36
37 void addContext(Folder folder, File pubspecFile) { 37 void addContext(Folder folder, File pubspecFile) {
38 PubFolder pubFolder = new PubFolder(analysisServer.defaultSdk, folder, pubsp ecFile); 38 ContextDirectory contextDirectory = new ContextDirectory(
39 analysisServer.folderMap[folder] = pubFolder; 39 analysisServer.defaultSdk, folder, pubspecFile);
40 analysisServer.addContextToWorkQueue(pubFolder.context); 40 analysisServer.folderMap[folder] = contextDirectory;
41 analysisServer.addContextToWorkQueue(contextDirectory.context);
41 } 42 }
42 43
43 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) { 44 void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) {
44 analysisServer.folderMap[contextFolder].context.applyChanges(changeSet); 45 analysisServer.folderMap[contextFolder].context.applyChanges(changeSet);
45 } 46 }
46 } 47 }
47 48
48 /** 49 /**
49 * Instances of the class [AnalysisServer] implement a server that listens on a 50 * Instances of the class [AnalysisServer] implement a server that listens on a
50 * [CommunicationChannel] for analysis requests and process them. 51 * [CommunicationChannel] for analysis requests and process them.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 // * A table mapping analysis contexts to the context id's associated with the m. 106 // * A table mapping analysis contexts to the context id's associated with the m.
106 // */ 107 // */
107 // final Map<AnalysisContext, String> contextIdMap = new Map<AnalysisContext, S tring>(); 108 // final Map<AnalysisContext, String> contextIdMap = new Map<AnalysisContext, S tring>();
108 109
109 /** 110 /**
110 * The current default [DartSdk]. 111 * The current default [DartSdk].
111 */ 112 */
112 DartSdk defaultSdk = SHARED_SDK; 113 DartSdk defaultSdk = SHARED_SDK;
113 114
114 /** 115 /**
115 * A table mapping [Folder]s to the [PubFolder]s associated with them. 116 * A table mapping [Folder]s to the [ContextDirectory]s associated with them.
116 */ 117 */
117 final Map<Folder, PubFolder> folderMap = <Folder, PubFolder>{}; 118 final Map<Folder, ContextDirectory> folderMap = <Folder, ContextDirectory>{};
118 119
119 /** 120 /**
120 * The context identifier used in the last status notification. 121 * The context identifier used in the last status notification.
121 */ 122 */
122 String lastStatusNotificationContextId = null; 123 String lastStatusNotificationContextId = null;
123 124
124 /** 125 /**
125 * A list of the analysis contexts for which analysis work needs to be 126 * A list of the analysis contexts for which analysis work needs to be
126 * performed. 127 * performed.
127 * 128 *
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 static const AnalysisService OUTLINE = const AnalysisService('OUTLINE', 3); 427 static const AnalysisService OUTLINE = const AnalysisService('OUTLINE', 3);
427 428
428 static const List<AnalysisService> VALUES = 429 static const List<AnalysisService> VALUES =
429 const [ERRORS, HIGHLIGHTS, NAVIGATION, OUTLINE]; 430 const [ERRORS, HIGHLIGHTS, NAVIGATION, OUTLINE];
430 431
431 const AnalysisService(String name, int ordinal) : super(name, ordinal); 432 const AnalysisService(String name, int ordinal) : super(name, ordinal);
432 } 433 }
433 434
434 435
435 /** 436 /**
436 * Instances of [PubFolder] represents a [Folder] with a Pub `pubspec.yaml`. 437 * Instances of [ContextDirectory] represents a [Folder] associated with an
438 * analysis context. The folder may or may not contain a Pub `pubspec.yaml`.
437 * 439 *
438 * TODO(scheglov) implement complete projects/contexts semantics. 440 * TODO(scheglov) implement complete projects/contexts semantics.
439 * 441 *
440 * This class is intentionally simplified to serve as a base to start working 442 * This class is intentionally simplified to serve as a base to start working
441 * on services while work on complete semantics is being done in parallel. 443 * on services while work on complete semantics is being done in parallel.
442 */ 444 */
443 class PubFolder { 445 class ContextDirectory {
444 /** 446 /**
445 * The root [Folder] of this [PubFolder]. 447 * The root [Folder] of this [ContextDirectory].
446 */ 448 */
447 final Folder _folder; 449 final Folder _folder;
448 450
449 /** 451 /**
450 * The `pubspec.yaml` file in [_folder], or null if there isn't one. 452 * The `pubspec.yaml` file in [_folder], or null if there isn't one.
451 */ 453 */
452 File _pubspecFile; 454 File _pubspecFile;
453 455
454 /** 456 /**
455 * The [AnalysisContext] of this [_folder]. 457 * The [AnalysisContext] of this [_folder].
456 */ 458 */
457 AnalysisContext _context; 459 AnalysisContext _context;
458 460
459 PubFolder(DartSdk sdk, this._folder, this._pubspecFile) { 461 ContextDirectory(DartSdk sdk, this._folder, this._pubspecFile) {
460 // create AnalysisContext 462 // create AnalysisContext
461 _context = AnalysisEngine.instance.createAnalysisContext(); 463 _context = AnalysisEngine.instance.createAnalysisContext();
462 // TODO(scheglov) replace FileUriResolver with an Resource based resolver 464 // TODO(scheglov) replace FileUriResolver with an Resource based resolver
463 // TODO(scheglov) create packages resolver 465 // TODO(scheglov) create packages resolver
464 _context.sourceFactory = new SourceFactory([ 466 _context.sourceFactory = new SourceFactory([
465 new DartUriResolver(sdk), 467 new DartUriResolver(sdk),
466 new FileUriResolver(), 468 new FileUriResolver(),
467 // new PackageUriResolver(), 469 // new PackageUriResolver(),
468 ]); 470 ]);
469 } 471 }
470 472
471 /** 473 /**
472 * Return the [AnalysisContext] of this folder. 474 * Return the [AnalysisContext] of this folder.
473 */ 475 */
474 AnalysisContext get context => _context; 476 AnalysisContext get context => _context;
475 } 477 }
476 478
477 479
478 /** 480 /**
479 * An enumeration of the services provided by the server domain. 481 * An enumeration of the services provided by the server domain.
480 */ 482 */
481 class ServerService extends Enum2<ServerService> { 483 class ServerService extends Enum2<ServerService> {
482 static const ServerService STATUS = const ServerService('STATUS', 0); 484 static const ServerService STATUS = const ServerService('STATUS', 0);
483 485
484 static const List<ServerService> VALUES = const [STATUS]; 486 static const List<ServerService> VALUES = const [STATUS];
485 487
486 const ServerService(String name, int ordinal) : super(name, ordinal); 488 const ServerService(String name, int ordinal) : super(name, ordinal);
487 } 489 }
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