Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1756 from microsoft/dev/gcampbell/Messaging
Browse files Browse the repository at this point in the history
Add popups and change readme
gcampbell-msft authored Aug 16, 2024
2 parents 6f24815 + 04e04a7 commit c88508d
Showing 9 changed files with 3,516 additions and 904 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -29,10 +29,10 @@ jobs:
# written, but it should be updated when VS Code updates its Node version.
# Node needs to be installed before OS-specific setup so that we can run
# the hash verification script.
- name: Use Node 16.x
- name: Use Node 18.x
uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 18.x

# On new macos-latest machines, Python 3.9+ is used, and it's causing issues with binding.gyp
- name: Use Python 3.8
@@ -79,7 +79,15 @@ jobs:
- name: Check for linting errors
run: gulp tslint
- name: Build and pack extension
run: node build/package.js
if: ${{ matrix.os != 'windows-latest' }}
run: |
export NODE_OPTIONS="--openssl-legacy-provider --no-experimental-fetch"
node build/package.js
- name: Build and pack extension
if: ${{ matrix.os == 'windows-latest' }}
run: |
$env:NODE_OPTIONS="--openssl-legacy-provider --no-experimental-fetch"
node build/package.js
- name: Publish extension VSIX as artifact
uses: actions/upload-artifact@v2
with:
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Visual Studio Code extension for Arduino
# Visual Studio Code extension for Arduino (deprecated)

> ⚠️ **Warning** ⚠️
>
> # This extension is deprecated and no longer maintained. We recommend existing customers to use the [Arduino IDE software](https://www.arduino.cc/en/software).
[![Gitter](https://img.shields.io/badge/chat-on%20gitter-blue.svg)](https://gitter.im/Microsoft/vscode-arduino)

16 changes: 12 additions & 4 deletions build/build.yml
Original file line number Diff line number Diff line change
@@ -27,9 +27,13 @@ jobs:
zipSources: false
condition: ne(variables['Build.Reason'], 'PullRequest')
- task: NodeTool@0
displayName: Use Node 16.x
displayName: Use Node 18.x
inputs:
versionSpec: 16.x
versionSpec: 18.x
- task: UsePythonVersion@0
displayName: Use Python 3.8
inputs:
versionSpec: 3.8
- ${{ if parameters.prerelease }}:
- pwsh: node -e "p=require('./package.json');p.version=p.version.replace(/\.\d+$/,'.'+$(Build.BuildNumber));require('fs').writeFileSync('./package.json',JSON.stringify(p,undefined,2))"
- script: npm install --global gulp node-gyp @vscode/vsce
@@ -49,10 +53,14 @@ jobs:
displayName: Use production AI key
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
- ${{ if parameters.prerelease }}:
- script: node build/package.js --pre-release
- pwsh: |
$env:NODE_OPTIONS="--no-experimental-fetch --openssl-legacy-provider"
node build/package.js --pre-release
displayName: Build and pack extension
- ${{ else }}:
- script: node build/package.js
- pwsh: |
$env:NODE_OPTIONS="--no-experimental-fetch --openssl-legacy-provider"
node build/package.js
displayName: Build and pack extension
- pwsh: |
$path = Join-Path $Env:TEMP "7z-installer.exe"
4 changes: 2 additions & 2 deletions build/prerelease.yml
Original file line number Diff line number Diff line change
@@ -54,9 +54,9 @@ extends:
- download: current
artifact: extension-vsixes
- task: NodeTool@0
displayName: Use Node 16.x
displayName: Use Node 18.x
inputs:
versionSpec: 16.x
versionSpec: 18.x
- script: npm install --global @vscode/vsce
displayName: Install vsce
- script: for f in $(Pipeline.Workspace)/extension-vsixes/*.vsix; do vsce publish --packagePath $f; done
4,161 changes: 3,378 additions & 783 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "vscode-arduino",
"displayName": "Arduino",
"description": "Arduino for Visual Studio Code",
"version": "0.6.0",
"displayName": "Arduino (deprecated)",
"description": "Arduino for Visual Studio Code. This extension is deprecated and no longer maintained.",
"version": "0.7.0",
"publisher": "vsciot-vscode",
"preview": true,
"engines": {
@@ -344,6 +344,7 @@
"@types/winreg": "^1.2.30",
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
"@vscode/vsce": "^2.16.0",
"acorn": "^7.4.0",
"ajv": "^6.12.3",
"babel-loader": "^8.2.2",
@@ -365,7 +366,7 @@
"gulp-typescript": "^5.0.1",
"minimist": "^1.2.6",
"mocha": "^6.2.3",
"node-gyp": "^6.1.0",
"node-gyp": "^8.4.0",
"plugin-error": "^1.0.1",
"tslint": "^5.20.1",
"typemoq": "^1.6.0",
35 changes: 14 additions & 21 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -28,7 +28,20 @@ import * as Logger from "./logger/logger";
import { SerialMonitor } from "./serialmonitor/serialMonitor";
const usbDetectorModule = impor("./serialmonitor/usbDetector") as typeof import ("./serialmonitor/usbDetector");

export function showDeprecatedPopup(): void {
vscode.window.
showWarningMessage(
"The Arduino extension is deprecated. Please view our README for more information.",
"View README",
).then((selection) => {
if (selection === "View README") {
vscode.commands.executeCommand("vscode.open", vscode.Uri.parse("https://aka.ms/arduinoextensionreadme"));
}
});
}

export async function activate(context: vscode.ExtensionContext) {
showDeprecatedPopup();
Logger.configure(context);
arduinoActivatorModule.default.context = context;
const activeGuid = uuidModule().replace(/-/g, "");
@@ -50,6 +63,7 @@ export async function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(deviceContext);

const commandExecution = async (command: string, commandBody: (...args: any[]) => any, args: any, getUserData?: () => any) => {
showDeprecatedPopup();
const guid = uuidModule().replace(/-/g, "");
Logger.traceUserData(`start-command-` + command, { correlationId: guid });
const timer1 = new Logger.Timer();
@@ -75,24 +89,6 @@ export async function activate(context: vscode.ExtensionContext) {
});
};

async function askSwitchToBundledCli(message: string): Promise<void> {
const result = await vscode.window.showErrorMessage(
message, "Use bundled arduino-cli", "View settings");
switch (result) {
case "Use bundled arduino-cli": {
Logger.traceUserData("switched-to-bundled-arduino-cli");
await vscodeSettings.setUseArduinoCli(true);
await vscodeSettings.setArduinoPath(undefined);
await vscodeSettings.setCommandPath(undefined);
await vscode.commands.executeCommand("workbench.action.reloadWindow");
break;
}
case "View settings":
await vscode.commands.executeCommand("workbench.action.openGlobalSettings");
break;
}
}

if (!vscodeSettings.useArduinoCli) {
// This notification is intentionally a little bit annoying (popping on
// workspace open with no permanent dismissal) because we want to move
@@ -104,7 +100,6 @@ export async function activate(context: vscode.ExtensionContext) {
// value of false. A future will make this breaking change with
// appropriate messaging.
Logger.traceUserData("using-legacy-arduino-ide");
void askSwitchToBundledCli(constants.messages.REMOVE_ARDUINO_IDE_SUPPORT + " " + constants.messages.SWITCH_TO_BUNDLED_CLI);
}

const registerArduinoCommand = (command: string, commandBody: (...args: any[]) => any, getUserData?: () => any): number => {
@@ -125,14 +120,12 @@ export async function activate(context: vscode.ExtensionContext) {
// Ask the user to switch to the bundled Arduino CLI if we can't resolve the specified path.
if (!usingBundledArduinoCli && (!arduinoPath || !validateArduinoPath(arduinoPath, useArduinoCli))) {
Logger.traceError("InvalidArduinoPath", new Error(constants.messages.INVALID_ARDUINO_PATH));
await askSwitchToBundledCli(constants.messages.INVALID_ARDUINO_PATH + " " + constants.messages.SWITCH_TO_BUNDLED_CLI);
} else if (!commandPath || !util.fileExistsSync(commandPath)) {
const error = new Error(constants.messages.INVALID_COMMAND_PATH + commandPath);
if (usingBundledArduinoCli) {
Logger.notifyUserError("InvalidCommandPath", error);
} else {
Logger.traceError("InvalidCommandPath", error);
await askSwitchToBundledCli(error.message + " " + constants.messages.SWITCH_TO_BUNDLED_CLI);
}
} else {
await commandExecution(command, commandBody, args, getUserData);
174 changes: 88 additions & 86 deletions src/views/package-lock.json
1 change: 1 addition & 0 deletions src/views/package.json
Original file line number Diff line number Diff line change
@@ -42,6 +42,7 @@
"async": "~3.2.3",
"node-sass": "^7.0.0",
"es5-ext": "0.10.53",
"source-map": "~0.8.0-beta.0",
"string_decoder": "https://github.com/microsoft/vscode-arduino/releases/download/v0.4.12-rc2/string_decoder-10.0.0.tgz"
}
}

0 comments on commit c88508d

Please sign in to comment.