Skip to content

Commit

Permalink
stop accessing driver.analysisOptions
Browse files Browse the repository at this point in the history
Change-Id: Ieb9d2581691b82f59b2a5540aaae2c3e453c078c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346944
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
  • Loading branch information
pq authored and Commit Queue committed Jan 18, 2024
1 parent b7f46d3 commit 4a7dd72
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions pkg/analysis_server/lib/src/status/diagnostics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@ String writeOption(String name, dynamic value) {
return '$name: <code>$value</code><br> ';
}

_CollectedOptionsData _collectOptionsData(AnalysisDriver driver) {
var collectedData = _CollectedOptionsData();
if (driver.analysisContext?.allAnalysisOptions case var allAnalysisOptions?) {
for (var analysisOptions in allAnalysisOptions) {
collectedData.lints.addAll(analysisOptions.lintRules.map((e) => e.name));
collectedData.plugins.addAll(analysisOptions.enabledPluginNames);
}
}
return collectedData;
}

class AnalyticsPage extends DiagnosticPageWithNav {
AnalyticsPage(DiagnosticsSite site)
: super(site, 'analytics', 'Analytics',
Expand Down Expand Up @@ -468,19 +479,6 @@ class CollectReportPage extends DiagnosticPage {
const JsonEncoder encoder = JsonEncoder.withIndent(' ');
return encoder.convert(collectedData);
}

_CollectedOptionsData _collectOptionsData(AnalysisDriver driver) {
var collectedData = _CollectedOptionsData();
if (driver.analysisContext?.allAnalysisOptions
case var allAnalysisOptions?) {
for (var analysisOptions in allAnalysisOptions) {
collectedData.lints
.addAll(analysisOptions.lintRules.map((e) => e.name));
collectedData.plugins.addAll(analysisOptions.enabledPluginNames);
}
}
return collectedData;
}
}

class CommunicationsPage extends DiagnosticPageWithNav {
Expand Down Expand Up @@ -761,9 +759,8 @@ class ContextsPage extends DiagnosticPageWithNav {
buf.writeln('</div>');

h3('Plugins');
// TODO(pq): migrate to *all* analysis options
// ignore: deprecated_member_use
p(driver.analysisOptions.enabledPluginNames.join(', '));
var optionsData = _collectOptionsData(driver);
p(optionsData.plugins.toList().join(', '));

var priorityFiles = driver.priorityFiles;
var addedFiles = driver.addedFiles.toList();
Expand Down

0 comments on commit 4a7dd72

Please sign in to comment.