maybeInstallIDEExtension method
Attempt to install the IDE extension.
Implementation
Future<IDEExtensionInstallationStatus?> maybeInstallIDEExtension(
IdeType ideType,
) async {
try {
if (isVSCodeIde(ideType)) {
final command = getVSCodeIDECommand(ideType);
if (command != null) {
final result = await Process.run(command, [
'--force',
'--install-extension',
'neom.neomage',
]);
if (result.exitCode != 0) {
throw Exception('${result.exitCode}: ${result.stderr}');
}
_logEvent('tengu_ext_installed', {});
return IDEExtensionInstallationStatus(
installed: true,
ideType: ideType,
);
}
}
return null;
} catch (e) {
_logEvent('tengu_ext_install_error', {});
_logError(e);
return IDEExtensionInstallationStatus(
installed: false,
error: e.toString(),
ideType: ideType,
);
}
}