OLD | NEW |
---|---|
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 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:core' hide Resource; | 9 import 'dart:core' hide Resource; |
10 import 'dart:math' show max; | 10 import 'dart:math' show max; |
(...skipping 15 matching lines...) Expand all Loading... | |
26 import 'package:analyzer/instrumentation/instrumentation.dart'; | 26 import 'package:analyzer/instrumentation/instrumentation.dart'; |
27 import 'package:analyzer/source/pub_package_map_provider.dart'; | 27 import 'package:analyzer/source/pub_package_map_provider.dart'; |
28 import 'package:analyzer/src/generated/ast.dart'; | 28 import 'package:analyzer/src/generated/ast.dart'; |
29 import 'package:analyzer/src/generated/element.dart'; | 29 import 'package:analyzer/src/generated/element.dart'; |
30 import 'package:analyzer/src/generated/engine.dart'; | 30 import 'package:analyzer/src/generated/engine.dart'; |
31 import 'package:analyzer/src/generated/java_engine.dart'; | 31 import 'package:analyzer/src/generated/java_engine.dart'; |
32 import 'package:analyzer/src/generated/sdk.dart'; | 32 import 'package:analyzer/src/generated/sdk.dart'; |
33 import 'package:analyzer/src/generated/source.dart'; | 33 import 'package:analyzer/src/generated/source.dart'; |
34 import 'package:analyzer/src/generated/source_io.dart'; | 34 import 'package:analyzer/src/generated/source_io.dart'; |
35 import 'package:analyzer/src/generated/utilities_general.dart'; | 35 import 'package:analyzer/src/generated/utilities_general.dart'; |
36 import 'package:glob/glob.dart'; | |
36 import 'package:plugin/plugin.dart'; | 37 import 'package:plugin/plugin.dart'; |
37 | 38 |
38 typedef void OptionUpdater(AnalysisOptionsImpl options); | 39 typedef void OptionUpdater(AnalysisOptionsImpl options); |
39 | 40 |
40 /** | 41 /** |
41 * Enum representing reasons why analysis might be done for a given file. | 42 * Enum representing reasons why analysis might be done for a given file. |
42 */ | 43 */ |
43 class AnalysisDoneReason { | 44 class AnalysisDoneReason { |
44 /** | 45 /** |
45 * Analysis of the file completed successfully. | 46 * Analysis of the file completed successfully. |
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1456 analysisServer.operationQueue.contextRemoved(context); | 1457 analysisServer.operationQueue.contextRemoved(context); |
1457 analysisServer._onContextsChangedController | 1458 analysisServer._onContextsChangedController |
1458 .add(new ContextsChangedEvent(removed: [context])); | 1459 .add(new ContextsChangedEvent(removed: [context])); |
1459 analysisServer.sendContextAnalysisDoneNotifications( | 1460 analysisServer.sendContextAnalysisDoneNotifications( |
1460 context, AnalysisDoneReason.CONTEXT_REMOVED); | 1461 context, AnalysisDoneReason.CONTEXT_REMOVED); |
1461 context.dispose(); | 1462 context.dispose(); |
1462 } | 1463 } |
1463 | 1464 |
1464 @override | 1465 @override |
1465 bool shouldFileBeAnalyzed(File file) { | 1466 bool shouldFileBeAnalyzed(File file) { |
1466 List<ShouldAnalyzeFile> functions = | 1467 List<String> patterns = analysisServer.serverPlugin.analyzedFilePatterns; |
1467 analysisServer.serverPlugin.analyzeFileFunctions; | 1468 for (String pattern in patterns) { |
1468 for (ShouldAnalyzeFile shouldAnalyzeFile in functions) { | 1469 if (new Glob(pattern).matches(file.path)) { |
scheglov
2015/11/02 16:27:49
I wonder if creating Glob instances might be a per
Brian Wilkerson
2015/11/02 16:54:38
It probably would be. I also realized that I'd for
| |
1469 if (shouldAnalyzeFile(file)) { | |
1470 // Emacs creates dummy links to track the fact that a file is open for | 1470 // Emacs creates dummy links to track the fact that a file is open for |
1471 // editing and has unsaved changes (e.g. having unsaved changes to | 1471 // editing and has unsaved changes (e.g. having unsaved changes to |
1472 // 'foo.dart' causes a link '.#foo.dart' to be created, which points to | 1472 // 'foo.dart' causes a link '.#foo.dart' to be created, which points to |
1473 // the non-existent file 'username@hostname.pid'. To avoid these dummy | 1473 // the non-existent file 'username@hostname.pid'. To avoid these dummy |
1474 // links causing the analyzer to thrash, just ignore links to | 1474 // links causing the analyzer to thrash, just ignore links to |
1475 // non-existent files. | 1475 // non-existent files. |
1476 return file.exists; | 1476 return file.exists; |
1477 } | 1477 } |
1478 } | 1478 } |
1479 return false; | 1479 return false; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1606 /** | 1606 /** |
1607 * The [PerformanceTag] for time spent in server request handlers. | 1607 * The [PerformanceTag] for time spent in server request handlers. |
1608 */ | 1608 */ |
1609 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 1609 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
1610 | 1610 |
1611 /** | 1611 /** |
1612 * The [PerformanceTag] for time spent in split store microtasks. | 1612 * The [PerformanceTag] for time spent in split store microtasks. |
1613 */ | 1613 */ |
1614 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 1614 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
1615 } | 1615 } |
OLD | NEW |