diff --git a/src/extension.ts b/src/extension.ts index c6704b6d..534c5e63 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -104,8 +104,11 @@ export async function activate(context: vscode.ExtensionContext) { return vscode.commands.executeCommand("vscode.previewHtml", BOARD_CONFIG_URI, vscode.ViewColumn.Two, "Arduino Board Configuration"); }); - registerArduinoCommand("arduino.showExamples", () => { + registerArduinoCommand("arduino.showExamples", (forceRefresh: boolean = false) => { vscode.commands.executeCommand("setContext", "vscode-arduino:showExampleExplorer", true); + if (forceRefresh) { + vscode.commands.executeCommand("arduino.reloadExample"); + } return vscode.commands.executeCommand("vscode.previewHtml", EXAMPLES_URI, vscode.ViewColumn.Two, "Arduino Examples"); }); diff --git a/src/serialmonitor/usbDetector.ts b/src/serialmonitor/usbDetector.ts index 9717549c..d60044d8 100644 --- a/src/serialmonitor/usbDetector.ts +++ b/src/serialmonitor/usbDetector.ts @@ -150,7 +150,7 @@ export class UsbDetector { if (!util.fileExistsSync(readmeFilePath)) { readmeFilePath = path.join(ArduinoContext.boardManager.currentBoard.platform.rootBoardPath, "README.md"); } - vscode.commands.executeCommand("setContext", "vscode-arduino:showExampleExplorer", true); + vscode.commands.executeCommand("arduino.showExamples", true); if (util.fileExistsSync(readmeFilePath)) { if (readmeFilePath.endsWith(MARKDOWN_EXT)) { vscode.commands.executeCommand("markdown.showPreview", vscode.Uri.file(readmeFilePath));