From 97279fdac1b2f40d94d1cc7eb2af1ca367ae7bc5 Mon Sep 17 00:00:00 2001 From: Daniel Banck Date: Mon, 15 Nov 2021 16:42:15 +0100 Subject: [PATCH] add open documentation menu --- package.json | 13 +++++++++++++ src/providers/providerProvider.ts | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/package.json b/package.json index a8548a7df8..6ba63eacf0 100644 --- a/package.json +++ b/package.json @@ -245,6 +245,11 @@ "command": "terraform.modules.openDocumentation", "title": "Open Documentation", "icon": "$(book)" + }, + { + "command": "terraform.providers.openDocumentation", + "title": "Open Documentation", + "icon": "$(book)" } ], "menus": { @@ -256,6 +261,10 @@ { "command": "terraform.modules.openDocumentation", "when": "false" + }, + { + "command": "terraform.providers.openDocumentation", + "when": "false" } ], "view/title": [ @@ -269,6 +278,10 @@ { "command": "terraform.modules.openDocumentation", "when": "view == terraform.modules" + }, + { + "command": "terraform.providers.openDocumentation", + "when": "view == terraform.providers" } ] }, diff --git a/src/providers/providerProvider.ts b/src/providers/providerProvider.ts index fc733833b7..3a10519766 100644 --- a/src/providers/providerProvider.ts +++ b/src/providers/providerProvider.ts @@ -44,6 +44,14 @@ export class ModuleProviderProvider implements vscode.TreeDataProvider { + vscode.env.openExternal( + // TODO! how do detect if provider is avaiable on the registry? + vscode.Uri.parse( + `https://registry.terraform.io/providers/${module.displayName}/${module.installedVersion ?? 'latest'}`, + ), + ); + }), ); }