Skip to content

Commit

Permalink
add open documentation menu
Browse files Browse the repository at this point in the history
  • Loading branch information
dbanck committed Nov 15, 2021
1 parent 6fb8c3f commit 97279fd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@
"command": "terraform.modules.openDocumentation",
"title": "Open Documentation",
"icon": "$(book)"
},
{
"command": "terraform.providers.openDocumentation",
"title": "Open Documentation",
"icon": "$(book)"
}
],
"menus": {
Expand All @@ -256,6 +261,10 @@
{
"command": "terraform.modules.openDocumentation",
"when": "false"
},
{
"command": "terraform.providers.openDocumentation",
"when": "false"
}
],
"view/title": [
Expand All @@ -269,6 +278,10 @@
{
"command": "terraform.modules.openDocumentation",
"when": "view == terraform.modules"
},
{
"command": "terraform.providers.openDocumentation",
"when": "view == terraform.providers"
}
]
},
Expand Down
8 changes: 8 additions & 0 deletions src/providers/providerProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ export class ModuleProviderProvider implements vscode.TreeDataProvider<ModulePro
this.refresh();
}
}),
vscode.commands.registerCommand('terraform.providers.openDocumentation', (module: ModuleProvider) => {
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'}`,
),
);
}),
);
}

Expand Down

0 comments on commit 97279fd

Please sign in to comment.