From 3aa01255a8debae5b0a7cc83cb533b135e3cd00a Mon Sep 17 00:00:00 2001 From: JackN Date: Fri, 12 Nov 2021 10:08:17 -0500 Subject: [PATCH 1/2] Convert `launch.json` properties to camelCase --- README.md | 22 ++++++++++---- package.json | 74 ++++++++++++++++++++++++------------------------ src/extension.ts | 14 ++++----- 3 files changed, 61 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 4ceba85..2ca9d95 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,7 @@ To work on this extensions, you first need to install VS Code and nodejs. Afterw ```bash yarn ``` -- Install a VS Code extension necessary for development: - ```bash - code --install-extension amodio.tsl-problem-matcher - ``` +- Install the extensions VS Code recommends - Open VS Code - Press F5 to start a new VS Code instance where the extension can be debugged. You can also open the "Run and Debug" panel in the left sidebar, and then start the "Extension" debug configuration. @@ -47,5 +44,20 @@ To work on this extensions, you first need to install VS Code and nodejs. Afterw * Select the debug environment `probe_rs Server Test`. * Press `F5` to start debugging. - +## Generating and releasing the extension +Because the extension is still regarded as being in 'Alpha' state, it is NOT being released on the Microsoft Visual Studio Code Extension Marketplace. The only way to get access to updated versions of the extension is to build it yourself, or to download it from the [GitHub release page](#development-setup) for this extension. + +### Build the extension +Building the extension refers to the process that generates the installable `.vsix` package. +* Follow the instructions to [setup your development environment](#development-setup). +* In a terminal window, execute the following command: +``` +yarn probe-rs:package +``` +* This will generate a .vsix file in the root of the repository + +### Updating the GitHub release page +After any PR has been merged, you need to consider if it is necessary to update the `.vsix` in the repository's [release page](https://github.com/probe-rs/vscode/releases). +* For minor fixes and changes, just update the asset for the latest release. +* For significant fixes and changes, please update the version number [see the Semantic Versioning guidelines](https://semver.org/), and create a new release tag. diff --git a/package.json b/package.json index 30895da..66021a5 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "configurationAttributes": { "launch": { "required": [ - "program_binary", + "programBinary", "chip" ], "properties": { @@ -100,7 +100,7 @@ "description": "Optionally onnect to an existing `probe-rs-debugger` session on IP and Port, e.g. '127.0.0.1:50000'", "default": "127.0.0.1:50000" }, - "program_binary": { + "programBinary": { "type": "string", "description": "The path (relative to `cwd` or absolute) to the binary for your target firmware", "default": "./target/debug/thumbv7em-none-eabihf/${workspaceFolderBasename}" @@ -114,7 +114,7 @@ "type": "string", "description": "Please specify the appropriate chip from the list of supported chips reported by running `probe-rs-debugger list-chips`." }, - "core_index": { + "coreIndex": { "type": "number", "description": "The zero based index of the MCU core for this session", "default": 0 @@ -143,7 +143,7 @@ "type": "number", "description": "Specify the protocol speed in kHz." }, - "wire_protocol": { + "wireProtocol": { "type": "string", "description": "The correct wire Protocol to use.", "enum": [ @@ -151,7 +151,7 @@ "Jtag" ] }, - "console_log_level": { + "consoleLogLevel": { "type": "string", "description": "The level of log info printed to the console. This also sets the RUST_LOG environment variable wherever possible.", "enum": [ @@ -163,49 +163,49 @@ ], "default": "Error" }, - "connect_under_reset": { + "connectUnderReset": { "type": "boolean", "description": "This option will result in the target reset pin being held high during the attach operation.", "default": false }, - "flashing_enabled": { + "flashingEnabled": { "type": "boolean", "description": "Flash the target before debugging.", "default": true }, - "reset_after_flashing": { + "resetAfterFlashing": { "type": "boolean", "description": "Reset the target after flashing.", "default": true }, - "halt_after_reset": { + "haltAfterReset": { "type": "boolean", "description": "Halt the target after reset.", "default": true }, - "full_chip_erase": { + "fullChipErase": { "type": "boolean", "description": "Do a full chip erase, versus page-by-page erase.", "default": false }, - "restore_unwritten_bytes": { + "restoreUnwrittenBytes": { "type": "boolean", "description": "Restore erased bytes that will not be rewritten from ELF.", "default": false }, - "rtt_enabled": { + "rttEnabled": { "type": "boolean", "description": "If true, the debugger will open an RTT Terminal tab for each of the active channels on the target.", "default": false }, - "rtt_channel_formats": { + "rttChannelFormats": { "type": "array", "items": { - "channel_number": { + "channelNumber": { "type": "number", - "description": "The channel number to which this data format applies. If any active channel numbers are omitted, we will assume the default will be `format=String', and 'show_timestamps=false'." + "description": "The channel number to which this data format applies. If any active channel numbers are omitted, we will assume the default will be `dataFormat=String', and 'showTimestamps=false'." }, - "data_format": { + "dataFormat": { "type": "string", "description": "One of the supported data formats for RTT channels.", "enum": [ @@ -220,10 +220,10 @@ ], "default": "String" }, - "show_timestamps": { + "showTimestamps": { "type": "boolean", "default": false, - "description": "Enable the inclusion of timestamps in the RTT output for `data_format=String`." + "description": "Enable the inclusion of timestamps in the RTT output for `dataFormat=String`." } } } @@ -232,7 +232,7 @@ "attach": { "required": [ "chip", - "program_binary" + "programBinary" ], "properties": { "server": { @@ -240,7 +240,7 @@ "description": "Optionally onnect to an existing `probe-rs-debugger` session on IP and Port, e.g. '127.0.0.1:50000'", "default": "127.0.0.1:50000" }, - "program_binary": { + "programBinary": { "type": "string", "description": "The path (relative to `cwd` or absolute) to the binary for your target firmware", "default": "./target/thumbv7em-none-eabihf/debug/${workspaceFolderBasename}" @@ -254,7 +254,7 @@ "type": "string", "description": "Please specify the appropriate chip from the list of supported chips reported by running `probe-rs-debugger list-chips`." }, - "core_index": { + "coreIndex": { "type": "number", "description": "The zero based index of the MCU core for this session", "default": 0 @@ -283,7 +283,7 @@ "type": "number", "description": "Specify the protocol speed in kHz." }, - "wire_protocol": { + "wireProtocol": { "type": "string", "description": "The correct wire Protocol to use.", "enum": [ @@ -291,7 +291,7 @@ "Jtag" ] }, - "console_log_level": { + "consoleLogLevel": { "type": "string", "description": "The level of log info printed to the console. This also sets the RUST_LOG environment variable wherever possible.", "enum": [ @@ -303,19 +303,19 @@ ], "default": "Error" }, - "rtt_enabled": { + "rttEnabled": { "type": "boolean", "description": "If true, the debugger will open an RTT Terminal tab for each of the active channels on the target.", "default": false }, - "rtt_channel_formats": { + "rttChannelFormats": { "type": "array", "items": { - "channel_number": { + "channelNumber": { "type": "number", - "description": "The channel number to which this data format applies. If any active channel numbers are omitted, we will assume the default will be `format=String', and 'show_timestamps=false'." + "description": "The channel number to which this data format applies. If any active channel numbers are omitted, we will assume the default will be `dataFormat=String', and 'showTimestamps=false'." }, - "data_format": { + "dataFormat": { "type": "string", "description": "One of the supported data formats for RTT channels.", "enum": [ @@ -330,10 +330,10 @@ ], "default": "String" }, - "show_timestamps": { + "showTimestamps": { "type": "boolean", "default": false, - "description": "Enable the inclusion of timestamps in the RTT output for `data_format=String`." + "description": "Enable the inclusion of timestamps in the RTT output for `dataFormat=String`." } } } @@ -345,12 +345,12 @@ "type": "probe-rs-debug", "request": "launch", "name": "probe-rs Test", - "program_binary": "./target/debug/thumbv7em-none-eabihf/${workspaceFolderBasename}", + "programBinary": "./target/debug/thumbv7em-none-eabihf/${workspaceFolderBasename}", "chip": "STM32H745ZITx", - "connect_under_reset": true, - "flashing_enabled": true, - "reset_after_flashing": true, - "halt_after_reset": true + "connectUnderReset": true, + "flashingEnabled": true, + "resetAfterFlashing": true, + "haltAfterReset": true } ], "configurationSnippets": [ @@ -361,9 +361,9 @@ "type": "probe-rs-debug", "request": "launch", "name": "probe-rs Test", - "program_binary": "./target/debug/thumbv7em-none-eabihf/${workspaceFolderBasename}", + "programBinary": "./target/debug/thumbv7em-none-eabihf/${workspaceFolderBasename}", "chip": "STM32H745ZITx", - "connect_under_reset": true + "connectUnderReset": true } } ] diff --git a/src/extension.ts b/src/extension.ts index f228ae6..ff6f967 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -90,8 +90,8 @@ class ProbeRSDebugAdapterServerDescriptorFactory implements vscode.DebugAdapterD // Make sure we have a terminal window per channel, for RTT Logging if (vscode.debug.activeDebugSession) { let session = vscode.debug.activeDebugSession; - if (session.configuration.hasOwnProperty('rtt_enabled') && - session.configuration.rtt_enabled) { + if (session.configuration.hasOwnProperty('rttEnabled') && + session.configuration.rttEnabled) { let channelWriteEmitter = new vscode.EventEmitter(); let channelPty: vscode.Pseudoterminal = { onDidWrite: channelWriteEmitter.event, @@ -134,10 +134,10 @@ class ProbeRSDebugAdapterServerDescriptorFactory implements vscode.DebugAdapterD switch (customEvent.event) { case 'probe-rs-rtt-channel-config': - this.createRttTerminal(+customEvent.body?.channel_number, customEvent.body?.data_format, customEvent.body?.channel_name); + this.createRttTerminal(+customEvent.body?.channelNumber, customEvent.body?.dataFormat, customEvent.body?.channelName); break; case 'probe-rs-rtt-data': - let incomingChannelNumber: number = +customEvent.body?.channel_number; + let incomingChannelNumber: number = +customEvent.body?.channelNumber; for (var [channelNumber, dataFormat, , channelWriteEmitter] of this.rttTerminals) { if (channelNumber === incomingChannelNumber) { switch (dataFormat) { @@ -176,7 +176,7 @@ class ProbeRSDebugAdapterServerDescriptorFactory implements vscode.DebugAdapterD } async createDebugAdapterDescriptor(session: vscode.DebugSession, executable: vscode.DebugAdapterExecutable | undefined): Promise { - probeRsLogLevel = session.configuration.console_log_level; + probeRsLogLevel = session.configuration.consoleLogLevel; // Initiate either the 'attach' or 'launch' request. // We do NOT use DebugAdapterExecutable @@ -210,8 +210,8 @@ class ProbeRSDebugAdapterServerDescriptorFactory implements vscode.DebugAdapterD args.push(debugServer[1]); var logEnv = 'error'; //This is the default - if (session.configuration.hasOwnProperty('console_log_level')) { - logEnv = session.configuration.console_log_level.toLowerCase(); + if (session.configuration.hasOwnProperty('consoleLogLevel')) { + logEnv = session.configuration.consoleLogLevel.toLowerCase(); }; var options = { From 886772654c69e66f1de89978c64ed47ee73e40d7 Mon Sep 17 00:00:00 2001 From: JackN Date: Fri, 12 Nov 2021 12:40:02 -0500 Subject: [PATCH 2/2] Changes to README and version update --- README.md | 17 ++++++++++------- package.json | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 2ca9d95..8764d15 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,10 @@ To work on this extensions, you first need to install VS Code and nodejs. Afterw ```bash yarn ``` -- Install the extensions VS Code recommends +- Install the extensions VS Code recommends. If you prefer to do this manually, you can find the list of recommended extensions in the repository's `.vscode/settings.json' file. These can then be installed from the command line, for example: + ```bash + code --install-extension amodio.tsl-problem-matcher + ``` - Open VS Code - Press F5 to start a new VS Code instance where the extension can be debugged. You can also open the "Run and Debug" panel in the left sidebar, and then start the "Extension" debug configuration. @@ -51,13 +54,13 @@ Because the extension is still regarded as being in 'Alpha' state, it is NOT bei Building the extension refers to the process that generates the installable `.vsix` package. * Follow the instructions to [setup your development environment](#development-setup). * In a terminal window, execute the following command: -``` -yarn probe-rs:package -``` + ``` + yarn probe-rs:package + ``` * This will generate a .vsix file in the root of the repository ### Updating the GitHub release page -After any PR has been merged, you need to consider if it is necessary to update the `.vsix` in the repository's [release page](https://github.com/probe-rs/vscode/releases). -* For minor fixes and changes, just update the asset for the latest release. -* For significant fixes and changes, please update the version number [see the Semantic Versioning guidelines](https://semver.org/), and create a new release tag. +* Whenever any PR has been merged, you need to create a new release and upload the `.vsix` in the repository's [release page](https://github.com/probe-rs/vscode/releases). +* This means that every PR needs to update the version number appropriately in the `package.json` file. Please [see the Semantic Versioning guidelines](https://semver.org/). + diff --git a/package.json b/package.json index 66021a5..0249503 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "probe-rs-debugger", "displayName": "Debugger for probe-rs", - "version": "0.3.0", + "version": "0.3.1", "publisher": "probe-rs", "description": "probe-rs Debug Adapter for VS Code.", "author": {