diff --git a/.gitignore b/.gitignore index adc7e6a..8a959f8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ /lib/ *.vsix yarn.lock +*.dict +.vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 63395e3..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "files.exclude": { - "lib": true - }, - "search.exclude": { - "**/lib/**": true - }, - "files.watcherExclude": { - "**/.git/objects/**": true, - "**/lib/*": true, - "**/node_modules/**": true - } -} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dc39e8..14ec93d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Release Notes +## 0.15.0 (2018-05-08) + +**Requires VSCode 1.23.0 or above** + +* New UI for [PIO Unified Debugger](http://docs.platformio.org/page/plus/debugging.html): + - Conditional Breakpoints + - Expressions and Watchpoints + - Generic Registers + - Peripheral Registers + - Memory Viewer + - Disassembly + - Multi-thread support + - A hot restart of an active debugging session +* Retain PIO Home state when switching between tabs (issue [#32](https://github.com/platformio/platformio-vscode-ide/issues/32)) + ## 0.14.2 (2018-04-28) * Fixed "PIP: Could not find a version that satisfies the requirement" (issue [#102](https://github.com/platformio/platformio-vscode-ide/issues/102)) @@ -10,7 +25,7 @@ ## 0.14.0 (2018-03-14) -* Intial support for PIO Enterprise +* Initial support for PIO Enterprise * Speed up the loading of PIO Home [PIO Home](http://docs.platformio.org/page/home/index.html) ## 0.13.2 (2018-03-08) diff --git a/package.json b/package.json index 4c753db..a4ec6ef 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,16 @@ { "name": "platformio-ide", - "version": "0.14.2", + "version": "0.15.0", "publisher": "platformio", "engines": { - "vscode": "^1.18.0" + "vscode": "^1.23.0" }, "license": "Apache-2.0", "displayName": "PlatformIO IDE", "description": "Development environment for IoT, Arduino, ARM mbed, Espressif (ESP8266/ESP32), STM32, PIC32, nRF51/nRF52, FPGA, CMSIS, SPL, AVR, Samsung ARTIK, libOpenCM3", "categories": [ + "Programming Languages", "Debuggers", - "Languages", "Other" ], "keywords": [ @@ -18,7 +18,7 @@ "embedded", "firmware", "debug", - "arduino" + "microcontroller" ], "preview": true, "main": "./lib/main", @@ -38,6 +38,58 @@ "*" ], "contributes": { + "languages": [ + { + "id": "platformio-debug.disassembly", + "aliases": [ + "Disassembly" + ], + "extensions": [ + ".dbgasm" + ] + }, + { + "id": "platformio-debug.memoryview", + "aliases": [ + "Memory" + ], + "extensions": [ + ".dbgmem" + ] + }, + { + "id": "platformio-debug.asm", + "aliases": [ + "Assembly", + "asm" + ], + "extensions": [ + ".asm", + ".nasm", + ".yasm", + ".inc", + ".s" + ], + "configuration": "./syntaxes/assembly-configuration.json" + } + ], + "grammars": [ + { + "language": "platformio-debug.disassembly", + "scopeName": "source.platformio-debug-disassembly", + "path": "./syntaxes/platformio-debug-disassembly.json" + }, + { + "language": "platformio-debug.memoryview", + "scopeName": "source.platformio-debug-memoryview", + "path": "./syntaxes/platformio-debug-memoryview.json" + }, + { + "language": "platformio-debug.asm", + "scopeName": "source.platformio-debug-asm", + "path": "./syntaxes/assembly.tmLanguage" + } + ], "commands": [ { "command": "platformio-ide.showHome", @@ -93,8 +145,277 @@ "command": "platformio-ide.upgradeCore", "title": "Upgrade PlatformIO Core to the latest version", "category": "PlatformIO" + }, + { + "category": "PlatformIO Debug", + "command": "platformio-debug.peripherals.updateNode", + "title": "Update Value" + }, + { + "category": "PlatformIO Debug", + "command": "platformio-debug.peripherals.selectedNode", + "title": "Selected" + }, + { + "category": "PlatformIO Debug", + "command": "platformio-debug.registers.selectedNode", + "title": "Selected" + }, + { + "category": "PlatformIO Debug", + "command": "platformio-debug.peripherals.copyValue", + "title": "Copy Value" + }, + { + "category": "PlatformIO Debug", + "command": "platformio-debug.registers.copyValue", + "title": "Copy Value" + }, + { + "category": "PlatformIO Debug", + "command": "platformio-debug.peripherals.setFormat", + "title": "Set Value Format" + }, + { + "category": "PlatformIO Debug", + "command": "platformio-debug.registers.setFormat", + "title": "Set Value Format" + }, + { + "category": "PlatformIO Debug", + "command": "platformio-debug.examineMemory", + "title": " View Memory", + "icon": { + "light": "resources/icons/add.svg", + "dark": "resources/icons/add-inverse.svg" + } + }, + { + "category": "PlatformIO Debug", + "command": "platformio-debug.memory.clearHistory", + "title": "Clear Memory View History", + "icon": { + "light": "resources/icons/closeall.svg", + "dark": "resources/icons/closeall-inverse.svg" + } + }, + { + "category": "PlatformIO Debug", + "command": "platformio-debug.memory.deleteHistoryItem", + "title": "Delete" + }, + { + "category": "PlatformIO Debug", + "command": "platformio-debug.viewDisassembly", + "title": "View Disassembly (Function)" + }, + { + "category": "PlatformIO Debug", + "command": "platformio-debug.setForceDisassembly", + "title": "Set Force Disassembly" } ], + "debuggers": [ + { + "enableBreakpointsFor": { + "languageIds": [ + "c", + "cpp", + "asm", + "arm", + "platformio-debug.disassembly" + ] + }, + "configurationAttributes": { + "launch": { + "properties": { + "executable": { + "description": "Path of firmware or program", + "type": "string" + }, + "toolchainBinDir": { + "description": "Path of toolchain binary directory", + "type": "string" + }, + "svdPath": { + "default": null, + "description": "Path to an SVD file describing the peripherals of the microcontroller", + "type": "string" + }, + "showDevDebugOutput": { + "default": false, + "description": "Prints all GDB responses to the console", + "type": "boolean" + } + }, + "required": [ + "executable", + "toolchainBinDir" + ] + } + }, + "initialConfigurations": [ + { + "name": "PlatformIO Debugger", + "request": "launch", + "type": "platformio-debug", + "toolchainBinDir": "/usr/local/bin" + } + ], + "configurationSnippets": [ + { + "body": { + "name": "${6:PlatformIO Debugger}", + "request": "launch", + "type": "platformio-debug", + "executable": ".pioenvs/myenv/firmware.elf", + "toolchainBinDir": "/usr/local/bin" + }, + "description": "PlatformIO Debugger", + "label": "PlatformIO Debugger" + } + ], + "label": "PlatformIO Debugger", + "program": "./node_modules/platformio-vscode-debug/lib/adapter.js", + "runtime": "node", + "type": "platformio-debug" + } + ], + "menus": { + "commandPalette": [ + { + "command": "platformio-debug.peripherals.updateNode", + "when": "false" + }, + { + "command": "platformio-debug.peripherals.selectedNode", + "when": "false" + }, + { + "command": "platformio-debug.peripherals.copyValue", + "when": "false" + }, + { + "command": "platformio-debug.peripherals.setFormat", + "when": "false" + }, + { + "command": "platformio-debug.registers.copyValue", + "when": "false" + }, + { + "command": "platformio-debug.registers.selectedNode", + "when": "false" + }, + { + "command": "platformio-debug.registers.setFormat", + "when": "false" + }, + { + "command": "platformio-debug.memory.deleteHistoryItem", + "when": "false" + }, + { + "command": "platformio-debug.examineMemory", + "when": "debugType == platformio-debug" + }, + { + "command": "platformio-debug.memory.clearHistory", + "when": "debugType == platformio-debug" + }, + { + "command": "platformio-debug.viewDisassembly", + "when": "debugType == platformio-debug" + }, + { + "command": "platformio-debug.setForceDisassembly", + "when": "debugType == platformio-debug" + } + ], + "view/item/context": [ + { + "command": "platformio-debug.peripherals.updateNode", + "when": "view == platformio-debug.peripherals && viewItem == field" + }, + { + "command": "platformio-debug.peripherals.updateNode", + "when": "view == platformio-debug.peripherals && viewItem == registerRW" + }, + { + "command": "platformio-debug.peripherals.updateNode", + "when": "view == platformio-debug.peripherals && viewItem == registerWO" + }, + { + "command": "platformio-debug.peripherals.copyValue", + "when": "view == platformio-debug.peripherals && viewItem == field" + }, + { + "command": "platformio-debug.peripherals.copyValue", + "when": "view == platformio-debug.peripherals && viewItem == registerRW" + }, + { + "command": "platformio-debug.peripherals.copyValue", + "when": "view == platformio-debug.peripherals && viewItem == registerRO" + }, + { + "command": "platformio-debug.registers.copyValue", + "when": "view == platformio-debug.registers && viewItem == register" + }, + { + "command": "platformio-debug.registers.copyValue", + "when": "view == platformio-debug.registers && viewItem == field" + }, + { + "command": "platformio-debug.peripherals.setFormat", + "when": "view == platformio-debug.peripherals" + }, + { + "command": "platformio-debug.registers.setFormat", + "when": "view == platformio-debug.registers" + }, + { + "command": "platformio-debug.memory.deleteHistoryItem", + "when": "view == platformio-debug.memory", + "group": "inline" + } + ], + "view/title": [ + { + "command": "platformio-debug.examineMemory", + "when": "view == platformio-debug.memory", + "group": "navigation" + }, + { + "command": "platformio-debug.memory.clearHistory", + "when": "view == platformio-debug.memory", + "group": "navigation" + } + ] + }, + "views": { + "debug": [ + { + "id": "platformio-debug.peripherals", + "name": "Peripherals", + "when": "debugType == platformio-debug && peripheralsEnabled" + }, + { + "id": "platformio-debug.registers", + "name": "Registers", + "when": "debugType == platformio-debug" + }, + { + "id": "platformio-debug.memory", + "name": "Memory", + "when": "debugType == platformio-debug" + }, + { + "id": "platformio-debug.disassembly", + "name": "Disassembly", + "when": "debugType == platformio-debug" + } + ] + }, "keybindings": [ { "command": "platformio-ide.build", @@ -222,10 +543,10 @@ "dependencies": { "fs-plus": "^3.0.0", "ini": "^1.3.4", - "platformio-node-helpers": "^0.5.2" + "platformio-node-helpers": "^0.5.2", + "platformio-vscode-debug": "^1.0.0" }, "extensionDependencies": [ - "ms-vscode.cpptools", - "webfreak.debug" + "ms-vscode.cpptools" ] } diff --git a/resources/icons/add-inverse.svg b/resources/icons/add-inverse.svg new file mode 100644 index 0000000..3475c1e --- /dev/null +++ b/resources/icons/add-inverse.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/icons/add.svg b/resources/icons/add.svg new file mode 100644 index 0000000..bdecdb0 --- /dev/null +++ b/resources/icons/add.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/icons/closeall-inverse.svg b/resources/icons/closeall-inverse.svg new file mode 100644 index 0000000..74e8dd8 --- /dev/null +++ b/resources/icons/closeall-inverse.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/icons/closeall.svg b/resources/icons/closeall.svg new file mode 100644 index 0000000..7250ff6 --- /dev/null +++ b/resources/icons/closeall.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/constants.js b/src/constants.js index 72582fe..7e96b80 100644 --- a/src/constants.js +++ b/src/constants.js @@ -11,4 +11,4 @@ export const IS_OSX = process.platform == 'darwin'; export const IS_LINUX = !IS_WINDOWS && !IS_OSX; export const AUTO_REBUILD_DELAY = 3000; -export const PIO_CORE_MIN_VERSION = '3.5.2-rc.3'; +export const PIO_CORE_MIN_VERSION = '3.5.2'; diff --git a/src/home.js b/src/home.js index 0366bcb..53ef49f 100644 --- a/src/home.js +++ b/src/home.js @@ -12,13 +12,52 @@ import { extension } from './main'; import vscode from 'vscode'; -export class HomeContentProvider { +export default class PIOHome { - static shutdownServer() { - pioNodeHelpers.home.shutdownServer(); + constructor() { + this._currentPanel = null; + } + + toggle() { + if (this._currentPanel) { + this._currentPanel.reveal(vscode.ViewColumn.One); + } else { + this._currentPanel = this.newPanel(); + } + } + + async newPanel() { + const panel = vscode.window.createWebviewPanel( + 'pioHome', + extension.getEnterpriseSetting('pioHomeTitle', 'PIO Home'), + vscode.ViewColumn.One, + { + enableScripts: true, + retainContextWhenHidden: true + } + ); + panel.onDidDispose(this.onPanelDisposed.bind(this)); + panel.webview.html = this.getLoadingContent(); + this.getWebviewContent().then(html => panel.webview.html = html ); + return panel; } - async provideTextDocumentContent(uri) { + getTheme() { + const workbench = vscode.workspace.getConfiguration('workbench') || {}; + return (workbench.colorTheme || '').toLowerCase().includes('light') ? 'light' : 'dark'; + } + + getLoadingContent() { + const theme = this.getTheme(); + return ` + +
+ Loading... + + `; + } + + async getWebviewContent() { const params = await pioNodeHelpers.home.ensureServerStarted({ onIDECommand: (command, params) => { if (command === 'open_project') { @@ -26,11 +65,10 @@ export class HomeContentProvider { } } }); - const start = `/${ uri.authority }`; - const workbench = vscode.workspace.getConfiguration('workbench') || {}; - const theme = (workbench.colorTheme || '').toLowerCase().includes('light') ? 'light' : 'dark'; - return ` - + const start = '/'; + const theme = this.getTheme(); + return ` +