本文整理汇总了TypeScript中vscode.env.openExternal方法的典型用法代码示例。如果您正苦于以下问题:TypeScript env.openExternal方法的具体用法?TypeScript env.openExternal怎么用?TypeScript env.openExternal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vscode.env
的用法示例。
在下文中一共展示了env.openExternal方法的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}`));
});
示例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);
}
}
}
示例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');
}
}
示例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'));
}
}
}
示例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');
}
}
示例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}`));
}