async end()

in generators/app/index.js [165:262]


    async end() {
        if (this.abort) {
            return;
        }

        if (this.extensionGenerator.update) {
            this.log('');
            this.log('Your extension has been updated!');
            this.log('');
            this.log('To start editing with Visual Studio Code, use the following commands:');
            this.log('');
            if (!this.extensionConfig.insiders) {
                this.log('     code .');
            } else {
                this.log('     code-insiders .');
            }
            this.log(`     ${this.extensionConfig.pkgManager} run compile-web`);
            this.log('');
            return;
        }

        // Git init
        if (this.extensionConfig.gitInit) {
            this.spawnCommand('git', ['init', '--quiet']);
        }

        if (this.extensionConfig.proposedAPI) {
            this.spawnCommand(this.extensionConfig.pkgManager, ['run', 'update-proposed-api']);
        }
        this.log('');

        this.log('Your extension ' + this.extensionConfig.name + ' has been created!');
        this.log('');

        const [codeStableLocation, codeInsidersLocation] = await Promise.all([witch('code').catch(() => undefined), witch('code-insiders').catch(() => undefined)]);

        if (!this.extensionConfig.insiders && !this.options['open'] && !this.options['openInInsiders'] && !this.options['quick']) {
            const cdLocation = this.options['destination'] || this.extensionConfig.name;

            this.log('To start editing with Visual Studio Code, use the following commands:');
            this.log('');
            if (!this.extensionConfig.insiders) {
                this.log('     code ' + cdLocation);
            } else {
                this.log('     code-insiders ' + cdLocation);
            }
            this.log('');
        }
        this.log('Open vsc-extension-quickstart.md inside the new extension for further instructions');
        this.log('on how to modify, test and publish your extension.');
        this.log('');

        if (this.extensionGenerator.endMessage) {
            this.extensionGenerator.endMessage(this, this.extensionConfig);
        }

        this.log('For more information, also visit http://code.visualstudio.com and follow us @code.');
        this.log('\r\n');

        if (this.options["open"]) {
            if (codeStableLocation) {
                this.log(`Opening ${this.destinationPath()} in Visual Studio Code...`);
                this.spawnCommand(codeStableLocation, [this.destinationPath()]);
            } else {
                this.log(`'code' command not found.`);
            }
        } else if (this.options["openInInsiders"]) {
            if (codeInsidersLocation) {
                this.log(`Opening ${this.destinationPath()} with Visual Studio Code Insiders...`);
                this.spawnCommand(codeInsidersLocation, [this.destinationPath()]);
            } else {
                this.log(`'code-insiders' command not found.`);
            }
        } else if (codeInsidersLocation || codeStableLocation) {
            if (this.options["quick"]) {
                this.spawnCommand(codeInsidersLocation || codeStableLocation, [this.destinationPath()]);
            } else {
                const choices = [];
                if (codeInsidersLocation) {
                    choices.push({ name: "Open with `code-insiders`", value: codeInsidersLocation });
                }
                if (codeStableLocation) {
                    choices.push({ name: "Open with `code`", value: codeStableLocation });
                }
                choices.push({ name: "Skip", value: 'skip' });

                const answer = await this.prompt({
                    type: "list",
                    name: "openWith",
                    message: "Do you want to open the new folder with Visual Studio Code?",
                    choices
                });
                if (answer && answer.openWith && answer.openWith !== 'skip') {
                    this.spawnCommand(answer.openWith, [this.destinationPath()]);
                }
            }
        }
    }