當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。