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]; |