MCPcopy Create free account
hub / github.com/microsoft/vscode-cpptools / installCompiler

Function installCompiler

Extension/src/LanguageServer/extension.ts:584–639  ·  view source on GitHub ↗
(sender?: any)

Source from the content-addressed store, hash-verified

582}
583
584async function installCompiler(sender?: any): Promise<void> {
585 const telemetryProperties = { sender: util.getSenderType(sender), platform: os.platform(), ranCommand: 'false' };
586 const ok = localize('ok', 'OK');
587 switch (os.platform()) {
588 case "win32":
589 showInstallCompilerWalkthrough();
590 break;
591 case "darwin": {
592 const title = localize('install.compiler.mac.title', 'The clang compiler will now be installed');
593 const detail = localize('install.compiler.mac.detail', 'You may be prompted to type your password in the VS Code terminal window to authorize the installation.');
594 const response = await vscode.window.showInformationMessage(title, { modal: true, detail }, ok);
595 if (response === ok) {
596 const terminal = vscode.window.createTerminal('Install C++ Compiler');
597 terminal.sendText('sudo xcode-select --install');
598 terminal.show();
599 telemetryProperties.ranCommand = 'true';
600 }
601 break;
602 }
603 default: {
604 const info = await PlatformInformation.GetPlatformInformation();
605 const installCommand = (() => {
606 switch (info.distribution?.name) {
607 case 'ubuntu':
608 case 'linuxmint':
609 case 'debian': {
610 return 'sudo sh -c \'apt update ; apt install -y build-essential\'';
611 }
612 case 'centos':
613 case 'fedora':
614 case 'rhel': {
615 return 'sudo sh -c \'yum install -y gcc-c++ gdb\'';
616 }
617 case 'opensuse':
618 case 'opensuse-leap':
619 case 'opensuse-tumbleweed': {
620 return 'sudo sh -c \'zypper refresh ; zypper install gcc-c++ gdb\'';
621 }
622 }
623 return undefined;
624 })();
625 if (installCommand) {
626 const title = localize('install.compiler.linux.title', 'The gcc compiler will now be installed');
627 const detail = localize('install.compiler.linux.detail', 'You may be prompted to type your password in the VS Code terminal window to authorize the installation.');
628 const response = await vscode.window.showInformationMessage(title, { modal: true, detail }, ok);
629 if (response === ok) {
630 const terminal = vscode.window.createTerminal('Install C++ Compiler');
631 terminal.sendText(installCommand);
632 terminal.show(true);
633 telemetryProperties.ranCommand = 'true';
634 }
635 }
636 }
637 }
638 telemetry.logLanguageServerEvent('installCompiler', telemetryProperties);
639}
640
641async function onSelectConfiguration(config?: string): Promise<void> {

Callers

nothing calls this directly

Calls 5

createTerminalMethod · 0.80
showMethod · 0.45

Tested by

no test coverage detected