-
Notifications
You must be signed in to change notification settings - Fork 30
Upgrading Extensions for V2 Compatibility
Alex Weininger edited this page Oct 13, 2022
·
20 revisions
Client extensions will undergo two updates related to the V2 API.
- Updates needed to make client extension compatible with V2 API, without actually consuming the V2 API.
- Full upgrade and migration to the V2 API. Lots of code changes will be required for this step.
This is a guide for part 1 of the upgrade.
Make these changes and raise a PR against the api-v2 branch (create the api-v2 branch if it doesn't exist).
- Update utils package
Currently, the latest utils package is https://github.com/microsoft/vscode-azuretools/pull/1229
- Replace
registerCommand
uses withregisterCommandWithTreeNodeUnwrapping
- Resolvers must be registered with an
AzExtResourceType
ID- The
id
argument when callingregisterApplicationResourceResolver
must be anAzExtResourceType
.
- The
- Add V2 contributions to package.json
"contributes": {
"x-azResourcesV2": {
"application": {
"branches": [
{
"type": "FunctionApp" // must match ID used to register the resolver
}
]
},
// needed if extension contributes workspace views
"workspace": {
"branches": [
{
"type": "func" // must match ID used to register the workspace resource provider
}
],
"resources": [
{
"type": "func" // must match ID used to register the workspace resource provider
}
]
}
},
- Commands should show on
azureResourceGroupsV2
view instead ofazureResourceGroups
view - Change commands attached to
azureResourceTypeGroup
tree items to useAzExtResourceType
contexts Example
Use Azure Functions as an example
Run the extension alongside Resource Groups, specifically the changes in this PR https://github.com/microsoft/vscode-azureresourcegroups/pull/358.
In Resource Groups repo:
- Checkout the
bmw/philliphoff-resource-api-compatshim
branch. - Install the local utils build from https://github.com/microsoft/vscode-azuretools/pull/1229
- Run
npm run compile
In client extension:
- Run and Debug the "Launch Extension + Host" configuration. You can create it if it doesn't exist. Example