Skip to content

Commit 922847a

Browse files
srawlinsCommit Queue
authored andcommitted
DAS plugins: Only analyze (and hence visit) .dart files
In it's current form, the lint rules are given _every_ file in the context root, including things like CHANGELOG.md, YAML files, etc, and it tries to parse them as Dart source. Change-Id: I0bd5a682fa4f22b857520bb99e7a3d8990c93e37 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396041 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Auto-Submit: Samuel Rawlins <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 17a2f16 commit 922847a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/analysis_server_plugin/lib/src/plugin_server.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import 'package:analyzer/src/dart/element/type_system.dart';
2929
import 'package:analyzer/src/lint/linter.dart';
3030
import 'package:analyzer/src/lint/linter_visitor.dart';
3131
import 'package:analyzer/src/lint/registry.dart';
32+
import 'package:analyzer/src/util/file_paths.dart' as file_paths;
3233
import 'package:analyzer_plugin/channel/channel.dart';
3334
import 'package:analyzer_plugin/protocol/protocol.dart';
3435
import 'package:analyzer_plugin/protocol/protocol_common.dart' as protocol;
@@ -190,7 +191,14 @@ class PluginServer {
190191
required AnalysisContextCollection contextCollection,
191192
}) async {
192193
await _forAnalysisContexts(contextCollection, (analysisContext) async {
193-
var paths = analysisContext.contextRoot.analyzedFiles().toList();
194+
var paths = analysisContext.contextRoot
195+
.analyzedFiles()
196+
// TODO(srawlins): Enable analysis on other files, even if only
197+
// YAML files for analysis options and pubspec analysis and quick
198+
// fixes.
199+
.where((p) => file_paths.isDart(_resourceProvider.pathContext, p))
200+
.toList();
201+
194202
await _analyzeFiles(
195203
analysisContext: analysisContext,
196204
paths: paths,

0 commit comments

Comments
 (0)