Commit 02429cef authored by Devon Carew's avatar Devon Carew Committed by GitHub

Fix the doctor check for the flutter intellij plugin (#12389)

* update the intellij doctor check to support the m18 plugin version

* update to support multiple package names
parent c314548f
...@@ -269,9 +269,9 @@ abstract class IntelliJValidator extends DoctorValidator { ...@@ -269,9 +269,9 @@ abstract class IntelliJValidator extends DoctorValidator {
Future<ValidationResult> validate() async { Future<ValidationResult> validate() async {
final List<ValidationMessage> messages = <ValidationMessage>[]; final List<ValidationMessage> messages = <ValidationMessage>[];
_validatePackage(messages, 'flutter-intellij.jar', 'Flutter', _validatePackage(messages, <String>['flutter-intellij', 'flutter-intellij.jar'],
minVersion: kMinFlutterPluginVersion); 'Flutter', minVersion: kMinFlutterPluginVersion);
_validatePackage(messages, 'Dart', 'Dart'); _validatePackage(messages, <String>['Dart'], 'Dart');
if (_hasIssues(messages)) { if (_hasIssues(messages)) {
messages.add(new ValidationMessage( messages.add(new ValidationMessage(
...@@ -309,15 +309,14 @@ abstract class IntelliJValidator extends DoctorValidator { ...@@ -309,15 +309,14 @@ abstract class IntelliJValidator extends DoctorValidator {
} }
} }
void _validatePackage(List<ValidationMessage> messages, String packageName, String title, { void _validatePackage(List<ValidationMessage> messages, List<String> packageNames, String title, {
Version minVersion Version minVersion
}) { }) {
for (String packageName in packageNames) {
if (!hasPackage(packageName)) { if (!hasPackage(packageName)) {
messages.add(new ValidationMessage.error( continue;
'$title plugin not installed; this adds $title specific functionality.'
));
return;
} }
final String versionText = _readPackageVersion(packageName); final String versionText = _readPackageVersion(packageName);
final Version version = new Version.parse(versionText); final Version version = new Version.parse(versionText);
if (version != null && minVersion != null && version < minVersion) { if (version != null && minVersion != null && version < minVersion) {
...@@ -329,6 +328,13 @@ abstract class IntelliJValidator extends DoctorValidator { ...@@ -329,6 +328,13 @@ abstract class IntelliJValidator extends DoctorValidator {
'$title plugin ${version != null ? "version $version" : "installed"}' '$title plugin ${version != null ? "version $version" : "installed"}'
)); ));
} }
return;
}
messages.add(new ValidationMessage.error(
'$title plugin not installed; this adds $title specific functionality.'
));
} }
String _readPackageVersion(String packageName) { String _readPackageVersion(String packageName) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment