本文整理匯總了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}`));
});
示例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}`));
}