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

Unified Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 1748763002: Move shouldFileBeAnalyzed into ContextManager (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/context_manager.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index cb66929cd6f14b9e61dcc1ec00503244ca61fd01..ae929716c61381954cb7df3bbb471077a31cf0a5 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -116,6 +116,12 @@ class AnalysisServer {
final ServerPlugin serverPlugin;
/**
+ * A list of the globs used to determine which files should be analyzed. The
+ * list is lazily created and should be accessed using [analyzedFilesGlobs].
+ */
+ List<Glob> _analyzedFilesGlobs = null;
+
+ /**
* The [ContextManager] that handles the mapping from analysis roots to
* context directories.
*/
@@ -327,6 +333,7 @@ class AnalysisServer {
packageResolverProvider,
embeddedResolverProvider,
packageMapProvider,
+ analyzedFilesGlobs,
instrumentationService,
defaultContextOptions);
ServerContextManagerCallbacks contextManagerCallbacks =
@@ -355,6 +362,27 @@ class AnalysisServer {
}
/**
+ * Return a list of the globs used to determine which files should be analyzed.
+ */
+ List<Glob> get analyzedFilesGlobs {
+ if (_analyzedFilesGlobs == null) {
+ _analyzedFilesGlobs = <Glob>[];
+ List<String> patterns = serverPlugin.analyzedFilePatterns;
+ for (String pattern in patterns) {
+ try {
+ _analyzedFilesGlobs
+ .add(new Glob(JavaFile.pathContext.separator, pattern));
+ } catch (exception, stackTrace) {
+ AnalysisEngine.instance.logger.logError(
+ 'Invalid glob pattern: "$pattern"',
+ new CaughtException(exception, stackTrace));
+ }
+ }
+ }
+ return _analyzedFilesGlobs;
+ }
+
+ /**
* The [Future] that completes when analysis is complete.
*/
Future get onAnalysisComplete {
@@ -1462,35 +1490,8 @@ class ServerContextManagerCallbacks extends ContextManagerCallbacks {
*/
final ResourceProvider resourceProvider;
- /**
- * A list of the globs used to determine which files should be analyzed. The
- * list is lazily created and should be accessed using [analyzedFilesGlobs].
- */
- List<Glob> _analyzedFilesGlobs = null;
-
ServerContextManagerCallbacks(this.analysisServer, this.resourceProvider);
- /**
- * Return a list of the globs used to determine which files should be analyzed.
- */
- List<Glob> get analyzedFilesGlobs {
- if (_analyzedFilesGlobs == null) {
- _analyzedFilesGlobs = <Glob>[];
- List<String> patterns = analysisServer.serverPlugin.analyzedFilePatterns;
- for (String pattern in patterns) {
- try {
- _analyzedFilesGlobs
- .add(new Glob(JavaFile.pathContext.separator, pattern));
- } catch (exception, stackTrace) {
- AnalysisEngine.instance.logger.logError(
- 'Invalid glob pattern: "$pattern"',
- new CaughtException(exception, stackTrace));
- }
- }
- }
- return _analyzedFilesGlobs;
- }
-
@override
AnalysisContext addContext(
Folder folder, AnalysisOptions options, FolderDisposition disposition) {
@@ -1541,22 +1542,6 @@ class ServerContextManagerCallbacks extends ContextManagerCallbacks {
}
@override
- bool shouldFileBeAnalyzed(File file) {
- for (Glob glob in analyzedFilesGlobs) {
- if (glob.matches(file.path)) {
- // Emacs creates dummy links to track the fact that a file is open for
- // editing and has unsaved changes (e.g. having unsaved changes to
- // 'foo.dart' causes a link '.#foo.dart' to be created, which points to
- // the non-existent file 'username@hostname.pid'. To avoid these dummy
- // links causing the analyzer to thrash, just ignore links to
- // non-existent files.
- return file.exists;
- }
- }
- return false;
- }
-
- @override
void updateContextPackageUriResolver(
Folder contextFolder, FolderDisposition disposition) {
AnalysisContext context = analysisServer.folderMap[contextFolder];
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/context_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698