当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript vscode.env类代码示例

本文整理汇总了TypeScript中vscode.env的典型用法代码示例。如果您正苦于以下问题:TypeScript env类的具体用法?TypeScript env怎么用?TypeScript env使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了env类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

    await this.pipeline(httpRequest, (err: ServiceError) => {
      if (err) {
        Output.outputLine(Constants.outputChannel.azureBlockchainServiceClient, err.message);
      }

      env.openExternal(Uri.parse(`${Constants.azurePortalBasUri}/resource/${urlDetailsOfConsortium}`));
    });
开发者ID:chrisseg,项目名称:vscode-azure-blockchain-ethereum,代码行数:7,代码来源:AzureBlockchainServiceClient.ts

示例2: showSupportGitLensMessage

    static async showSupportGitLensMessage() {
        const actions: MessageItem[] = [
            { title: 'Become a Sponsor' },
            { title: 'Donate via PayPal' },
            { title: 'Donate via Cash App' }
        ];

        const result = await Messages.showMessage(
            'info',
            'While GitLens is offered to everyone for free, if you find it useful, please consider [supporting](https://gitlens.amod.io/#support-gitlens) it. Thank you! ❤',
            undefined,
            null,
            ...actions
        );

        if (result != null) {
            let uri;
            if (result === actions[0]) {
                uri = Uri.parse('https://www.patreon.com/eamodio');
            }
            else if (result === actions[1]) {
                uri = Uri.parse('https://www.paypal.me/eamodio');
            }
            else if (result === actions[2]) {
                uri = Uri.parse('https://cash.me/$eamodio');
            }

            if (uri !== undefined) {
                await setCommandContext(CommandContext.ViewsHideSupportGitLens, true);
                await this.suppressedMessage(SuppressedMessages.SupportGitLensNotification!);
                await env.openExternal(uri);
            }
        }
    }
开发者ID:chrisleaman,项目名称:vscode-gitlens,代码行数:34,代码来源:messages.ts

示例3: execute

    async execute(args: ExternalDiffCommandArgs = {}) {
        try {
            let repoPath;
            if (args.files === undefined) {
                const editor = window.activeTextEditor;
                if (editor === undefined) return undefined;

                repoPath = await Container.git.getRepoPathOrActive(undefined, editor);
                if (!repoPath) return undefined;

                const uri = editor.document.uri;
                const status = await Container.git.getStatusForFile(repoPath, uri.fsPath);
                if (status === undefined) {
                    return window.showInformationMessage("The current file doesn't have any changes");
                }

                args.files = [];
                if (status.indexStatus === 'M') {
                    args.files.push({ uri: status.uri, staged: true });
                }

                if (status.workingTreeStatus === 'M') {
                    args.files.push({ uri: status.uri, staged: false });
                }
            }
            else {
                repoPath = await Container.git.getRepoPath(args.files[0].uri.fsPath);
                if (!repoPath) return undefined;
            }

            const tool = await Container.git.getDiffTool(repoPath);
            if (tool === undefined) {
                const result = await window.showWarningMessage(
                    'Unable to open changes in diff tool. No Git diff tool is configured',
                    'View Git Docs'
                );
                if (!result) return undefined;

                return env.openExternal(
                    Uri.parse('https://git-scm.com/docs/git-config#Documentation/git-config.txt-difftool')
                );
            }

            for (const file of args.files) {
                void Container.git.openDiffTool(repoPath, file.uri, {
                    ref1: file.ref1,
                    ref2: file.ref2,
                    staged: file.staged,
                    tool: tool
                });
            }

            return undefined;
        }
        catch (ex) {
            Logger.error(ex, 'ExternalDiffCommand');
            return Messages.showGenericErrorMessage('Unable to open changes in diff tool');
        }
    }
开发者ID:chrisleaman,项目名称:vscode-gitlens,代码行数:59,代码来源:externalDiff.ts

示例4: showWhatsNewMessage

    static async showWhatsNewMessage(version: string) {
        const actions: MessageItem[] = [{ title: "What's New" }, { title: 'Release Notes' }, { title: '❤' }];

        const result = await Messages.showMessage(
            'info',
            `GitLens has been updated to v${version} — check out what's new!`,
            undefined,
            null,
            ...actions
        );

        if (result != null) {
            if (result === actions[0]) {
                await commands.executeCommand(Commands.ShowWelcomePage);
            }
            else if (result === actions[1]) {
                await env.openExternal(Uri.parse('https://github.com/eamodio/vscode-gitlens/blob/master/CHANGELOG.md'));
            }
            else if (result === actions[2]) {
                await env.openExternal(Uri.parse('https://gitlens.amod.io/#support-gitlens'));
            }
        }
    }
开发者ID:chrisleaman,项目名称:vscode-gitlens,代码行数:23,代码来源:messages.ts

示例5: execute

    async execute(editor?: TextEditor, uri?: Uri, args: DiffDirectoryCommandArgs = {}) {
        uri = getCommandUri(uri, editor);

        try {
            const repoPath = await getRepoPathOrActiveOrPrompt(
                uri,
                editor,
                `Compare directory in which repository${GlyphChars.Ellipsis}`
            );
            if (!repoPath) return undefined;

            if (!args.ref1) {
                args = { ...args };

                const pick = await new ReferencesQuickPick(repoPath).show(
                    `Compare Working Tree with${GlyphChars.Ellipsis}`,
                    { allowEnteringRefs: true }
                );
                if (pick === undefined) return undefined;

                if (pick instanceof CommandQuickPickItem) return pick.execute();

                args.ref1 = pick.ref;
                if (args.ref1 === undefined) return undefined;
            }

            await Container.git.openDirectoryDiff(repoPath, args.ref1, args.ref2);
            return undefined;
        }
        catch (ex) {
            const msg = ex && ex.toString();
            if (msg === 'No diff tool found') {
                const result = await window.showWarningMessage(
                    'Unable to open directory compare because there is no Git diff tool configured',
                    'View Git Docs'
                );
                if (!result) return undefined;

                return env.openExternal(
                    Uri.parse('https://git-scm.com/docs/git-config#Documentation/git-config.txt-difftool')
                );
            }

            Logger.error(ex, 'DiffDirectoryCommand');
            return Messages.showGenericErrorMessage('Unable to open directory compare');
        }
    }
开发者ID:chrisleaman,项目名称:vscode-gitlens,代码行数:47,代码来源:diffDirectory.ts

示例6: launchWebview

    public static launchWebview() {
        const workspacePath = vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders[0].uri.fsPath : '';
        const htmlPath = path.join(workspacePath, 'drizzle', 'index.html');

        vscode.env.openExternal(vscode.Uri.parse(`file://${htmlPath}`));
    }
开发者ID:chrisseg,项目名称:vscode-azure-blockchain-ethereum,代码行数:6,代码来源:UiServer.ts


注:本文中的vscode.env类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。