isIDEExtensionInstalled method

Future<bool> isIDEExtensionInstalled(
  1. IdeType ideType, {
  2. String extensionId = 'neom.neomage',
})

Check if the IDE extension is installed for a given IDE type.

Implementation

Future<bool> isIDEExtensionInstalled(
  IdeType ideType, {
  String extensionId = 'neom.neomage',
}) async {
  if (isVSCodeIde(ideType)) {
    final command = getVSCodeIDECommand(ideType);
    if (command != null) {
      try {
        final result = await Process.run(command, ['--list-extensions']);
        return (result.stdout as String?)?.contains(extensionId) == true;
      } catch (_) {}
    }
  }
  return false;
}