Skip to content

Commit

Permalink
check if remote containers extension is active (#627)
Browse files Browse the repository at this point in the history
* check if remote containers extension is active

* avoid generating dev container definition files when remote - containers is not active
  • Loading branch information
mhshami01 authored Feb 4, 2022
1 parent ea78361 commit 3cdb3ad
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Change Log
## 1.25.7 - 2022-02-04
### Changed
* Fixed dev container load errors when dependency list include VSCode Remote Containers extension.

## 1.25.6 - 2022-01-28
### Changed
* Fixed issue with Dev Container generation for External module sources
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "azure-iot-edge",
"displayName": "Azure IoT Edge",
"description": "This extension is now a part of Azure IoT Tools extension pack. We highly recommend installing Azure IoT Tools to get full capabilities for Azure IoT development. Develop, deploy, debug, and manage your IoT Edge solution.",
"version": "1.25.6",
"version": "1.25.7",
"publisher": "vsciot-vscode",
"aiKey": "95b20d64-f54f-4de3-8ad5-165a75a6c6fe",
"icon": "logo.png",
Expand Down Expand Up @@ -588,7 +588,6 @@
},
"extensionDependencies": [
"ms-vscode.azure-account",
"ms-vscode-remote.remote-containers",
"vsciot-vscode.azure-iot-toolkit"
]
}
10 changes: 8 additions & 2 deletions src/edge/edgeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,12 @@ export class EdgeManager {
return;
}

const remoteExtenstion = vscode.extensions.getExtension("ms-vscode-remote.remote-containers");
if (remoteExtenstion === undefined) {
vscode.window.showInformationMessage("This feature requires the 'Remote - Container' extension be installed and active. Please see http://aka.ms/remcon for more details.");
return;
}

const workspaceFolders = vscode.workspace.workspaceFolders;
const defaultFolder: vscode.Uri | undefined = workspaceFolders && workspaceFolders.length > 0 ? workspaceFolders[0].uri : undefined;
const workspaceFolder = defaultFolder.fsPath;
Expand Down Expand Up @@ -348,6 +354,7 @@ export class EdgeManager {
description: "",
},
];

const doYouWishToReload = await vscode.window.showQuickPick(reloadDontReload, { placeHolder: Constants.reloadInDevContainer, ignoreFocusOut: true });
if (doYouWishToReload && doYouWishToReload.label === Constants.CHOICE_YES) {
await vscode.commands.executeCommand("remote-containers.reopenInContainer", vscode.Uri.file(workspaceFolder), false);
Expand Down Expand Up @@ -1003,8 +1010,7 @@ export class EdgeManager {
vscode.window.showInformationMessage("New module for '" + template + "'");
}

if (containerSource.length > 0)
{
if (containerSource.length > 0) {
await fse.copy(containerSource, slnPath, { overwrite : true });
await fse.copy(sourceLibrayScriptsPath, path.join(slnPath, Constants.dotDevContainer, Constants.libraryScriptsFolder));
}
Expand Down

0 comments on commit 3cdb3ad

Please sign in to comment.