Skip to content

Commit e0c04b3

Browse files
committed
Provide PlatformIO IDE Release Notes // Resolve platformio#2412
1 parent 6f49575 commit e0c04b3

File tree

5 files changed

+159
-22
lines changed

5 files changed

+159
-22
lines changed

CHANGELOG.md

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,35 @@
44

55
**Requires VSCode 1.65 or above**
66

7-
- Project Management
8-
* IntelliSense for [platformio.ini](https://docs.platformio.org/en/latest/projectconf/index.html) configuration file
9-
- Auto-completion for configuration options
10-
- Auto-completion for choice-based option values
11-
- Hover over the option and get a quick documentation
12-
- Realtime serial port auto-completion for port-related options
13-
- Quickly jump to the development platform or library located in the PlatformIO Registry
14-
* Native integration of [PlatformIO Unit Testing](https://docs.platformio.org/en/latest/advanced/unit-testing/index.html) with VSCode Testing UI
15-
* New port switcher to override upload, monitor, or testing port (issue [#545](https://github.com/platformio/platformio-vscode-ide/issues/545))
16-
* Advanced project configuring progress with logging and canceling features
17-
- Navigation
18-
* Added support for the macOS Touch Bar (issue [#311](https://github.com/platformio/platformio-vscode-ide/issues/311))
19-
* Added "Build/Upload/Test/Clean" and "Serial Monitor" buttons to the Editor title bar
20-
* Added PlatformIO base commands to the Explorer context menu
21-
* Configure custom buttons and commands in PlatformIO Toolbar with a new `platformio-ide.toolbar` configuration option (issue [#1697](https://github.com/platformio/platformio-vscode-ide/issues/1697))
22-
- UX/UI Improvements
23-
* Added walkthroughs (Menu: Help > Get Started) to introduce users to the features of the PlatformIO ecosystem
24-
* Activate PlatformIO IDE extension when intending to use PlatformIO (issue [#66](https://github.com/platformio/platformio-vscode-ide/issues/66))
25-
* Activate keyboard shortcuts when PlatformIO Project is opened (issue [#3324](https://github.com/platformio/platformio-vscode-ide/issues/3324))
26-
- Miscellaneous
27-
* Fixed an issue with "'platformio-ide.build' not found" (issue [#1398](https://github.com/platformio/platformio-vscode-ide/issues/1398))
7+
### Project Management
8+
9+
* IntelliSense for [platformio.ini](https://docs.platformio.org/en/latest/projectconf/index.html) configuration file
10+
- Auto-completion for configuration options
11+
- Auto-completion for choice-based option values
12+
- Hover over the option and get a quick documentation
13+
- Realtime serial port auto-completion for port-related options
14+
- Quickly jump to the development platform or library located in the PlatformIO Registry
15+
* Native integration of [PlatformIO Unit Testing](https://docs.platformio.org/en/latest/advanced/unit-testing/index.html) with VSCode Testing UI
16+
* New port switcher to override upload, monitor, or testing port (issue [#545](https://github.com/platformio/platformio-vscode-ide/issues/545))
17+
* Advanced project configuring progress with logging and canceling features
18+
19+
### Navigation
20+
21+
* Added support for the macOS Touch Bar (issue [#311](https://github.com/platformio/platformio-vscode-ide/issues/311))
22+
* Added "Build/Upload/Test/Clean" and "Serial Monitor" buttons to the Editor title bar
23+
* Added PlatformIO base commands to the Explorer context menu
24+
* Configure custom buttons and commands in PlatformIO Toolbar with a new `platformio-ide.toolbar` configuration option (issue [#1697](https://github.com/platformio/platformio-vscode-ide/issues/1697))
25+
26+
### UX/UI Improvements
27+
28+
* Added walkthroughs (Menu: Help > Get Started) to introduce users to the features of the PlatformIO ecosystem
29+
* Provide PlatformIO IDE Release Notes (issue [#2412](https://github.com/platformio/platformio-vscode-ide/issues/2412))
30+
* Activate PlatformIO IDE extension when intending to use PlatformIO (issue [#66](https://github.com/platformio/platformio-vscode-ide/issues/66))
31+
* Activate keyboard shortcuts when PlatformIO Project is opened (issue [#3324](https://github.com/platformio/platformio-vscode-ide/issues/3324))
32+
33+
### Miscellaneous
34+
35+
* Fixed an issue with "'platformio-ide.build' not found" (issue [#1398](https://github.com/platformio/platformio-vscode-ide/issues/1398))
2836

2937
## 2.5.5 (2022-10-31)
3038

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"onView:platformio-debug.registers",
4444
"onView:platformio-debug.memory",
4545
"onView:platformio-debug.disassembly",
46+
"onCommand:platformio-ide.showReleaseNotes",
4647
"onCommand:platformio-ide.showHome",
4748
"onCommand:platformio-ide.openPIOCoreCLI"
4849
],
@@ -100,6 +101,11 @@
100101
}
101102
],
102103
"commands": [
104+
{
105+
"command": "platformio-ide.showReleaseNotes",
106+
"title": "Show Release Notes",
107+
"category": "PlatformIO"
108+
},
103109
{
104110
"command": "platformio-ide.showHome",
105111
"title": "PlatformIO Home",

src/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import * as utils from './utils';
1313

1414
import InstallationManager from './installer/manager';
1515
import PIOHome from './home';
16+
import PIOReleaseNotes from './release-notes';
1617
import PIOTerminal from './terminal';
1718
import PIOToolbar from './toolbar';
1819
import ProjectManager from './project/manager';
@@ -36,7 +37,7 @@ class PlatformIOVSCodeExtension {
3637
this.context = context;
3738
this.pioHome = new PIOHome();
3839
this.pioTerm = new PIOTerminal();
39-
this.subscriptions.push(this.pioHome, this.pioTerm);
40+
this.subscriptions.push(this.pioHome, this.pioTerm, new PIOReleaseNotes());
4041
const hasPIOProject = getPIOProjectDirs().length > 0;
4142

4243
// dump global state

src/release-notes.js

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/**
2+
* Copyright (c) 2017-present PlatformIO <contact@platformio.org>
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the license found in the LICENSE file in
6+
* the root directory of this source tree.
7+
*/
8+
9+
import { disposeSubscriptions } from './utils';
10+
import { extension } from './main';
11+
import { promises as fs } from 'fs';
12+
import path from 'path';
13+
import vscode from 'vscode';
14+
15+
export default class PIOReleaseNotes {
16+
constructor() {
17+
this.version = extension.context.extension.packageJSON.version;
18+
this._currentPanel = undefined;
19+
20+
this.subscriptions = [
21+
vscode.commands.registerCommand('platformio-ide.showReleaseNotes', () =>
22+
this.toggle()
23+
),
24+
];
25+
26+
const stateKey = 'showedReleaseNotesFor';
27+
if (extension.context.globalState.get(stateKey) !== this.version) {
28+
extension.context.globalState.update(stateKey, this.version);
29+
this.toggle();
30+
}
31+
}
32+
33+
dispose() {
34+
disposeSubscriptions(this.subscriptions);
35+
}
36+
37+
async toggle() {
38+
const column = vscode.window.activeTextEditor
39+
? vscode.window.activeTextEditor.viewColumn
40+
: undefined;
41+
try {
42+
if (this._currentPanel) {
43+
this._currentPanel.webview.html = await this.getWebviewContent();
44+
return this._currentPanel.reveal(column);
45+
}
46+
} catch (err) {
47+
console.warn(err);
48+
}
49+
this._currentPanel = await this.newPanel();
50+
}
51+
52+
async newPanel(startUrl) {
53+
const panel = vscode.window.createWebviewPanel(
54+
'pioReleaseNotes',
55+
'PlatformIO IDE: Release Notes',
56+
vscode.ViewColumn.One,
57+
{
58+
enableScripts: true,
59+
retainContextWhenHidden: true,
60+
}
61+
);
62+
panel.onDidDispose(
63+
() => (this._currentPanel = undefined),
64+
undefined,
65+
this.subscriptions
66+
);
67+
panel.webview.html = await this.getWebviewContent(startUrl);
68+
return panel;
69+
}
70+
71+
async getWebviewContent() {
72+
const releaseNotes = await this.readReleaseNotes();
73+
return `
74+
<!DOCTYPE html>
75+
<html lang="en">
76+
<head>
77+
<meta charset="UTF-8">
78+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
79+
<title>PlatformIO IDE: Release Notes</title>
80+
</head>
81+
<body>
82+
<div id="content">Loading...</div>
83+
<textarea id="pioRNMarkdown" hidden="hidden">
84+
# PlatformIO IDE Release Notes
85+
86+
Welcome to the ${this.version} release of PlatformIO IDE.
87+
There are many updates in this version that we hope you'll like.
88+
89+
**PlatformIO Core**: If you would like to read the PlatformIO Core release notes, go to the [Release Notes](https://docs.platformio.org/en/latest/core/history.html) on [docs.platformio.org](https://docs.platformio.org/).
90+
91+
${releaseNotes}
92+
93+
## Stay in touch with us
94+
95+
Please follow us on [LinkedIn](https://www.linkedin.com/company/platformio) and Twitter [@PlatformIO_Org](https://twitter.com/PlatformIO_Org) to keep up to date with the latest news, articles and tips!
96+
97+
-----
98+
99+
**Release History**: Want to read release notes for the previous versions? Please visit [PlatformIO IDE Changelog](https://github.com/platformio/platformio-vscode-ide/blob/develop/CHANGELOG.md) for more detailed information.
100+
101+
</textarea>
102+
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
103+
<script>
104+
document.getElementById('content').innerHTML =
105+
marked.parse(document.getElementById('pioRNMarkdown').value);
106+
</script>
107+
</body>
108+
</html>`;
109+
}
110+
111+
async readReleaseNotes() {
112+
const changelogPath = path.join(extension.context.extensionPath, 'CHANGELOG.md');
113+
try {
114+
const contents = await fs.readFile(changelogPath, { encoding: 'utf-8' });
115+
const startsAt = contents.indexOf('\n## ');
116+
return contents.substring(startsAt, contents.indexOf('\n## ', startsAt + 3));
117+
} catch (err) {
118+
return err.toString();
119+
}
120+
}
121+
}

src/views/quick-access-tree.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export default class QuickAccessTreeProvider {
6666
new QuickItem('Clone Git Project', 'git.clone'),
6767
new QuickItem('New Terminal', 'platformio-ide.newTerminal'),
6868
new QuickItem('Upgrade PlatformIO Core', 'platformio-ide.upgradeCore'),
69+
new QuickItem('Show Release Notes', 'platformio-ide.showReleaseNotes'),
6970
]
7071
),
7172
];

0 commit comments

Comments
 (0)