Skip to content

Commit 7c3291b

Browse files
committed
πŸ§‘β€πŸ’» [2.1.77] Rename "Docs" view
1 parent b68fc0c commit 7c3291b

File tree

8 files changed

+90
-101
lines changed

8 files changed

+90
-101
lines changed

β€ŽCHANGELOG.mdβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
The following enhancements and changes have been made to ***Auto Build Marlin***.
44

5+
## 2.1.77
6+
- Docs Panel: Replacing "Info" panel
7+
- Docs Panel: Filter now includes group name
8+
59
## 2.1.76
610
- Info Panel: Clean up appearance
711

β€ŽREADME.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The Auto Build Marlin extension for VSCode contributes sidebar panels, a web vie
7474

7575
### Bootstrapping
7676

77-
When VSCode starts the extension it just loads `extension.js`. This file imports `abm.js` and `prefs.js` for utility functions, and `format.js`, `info.js`, and `editor.js` for our feature providers. These files import `js/marlin.js` and `js/schema.js` to process Marlin files, and node `fs` for file functions. Any top level code in these files runs as soon as `extension.js` does. This is when modules init their classes and export their symbols.
77+
When VSCode starts the extension it just loads `extension.js`. This file imports `abm.js` and `prefs.js` for utility functions, and `format.js`, `docs.js`, and `editor.js` for our feature providers. These files import `js/marlin.js` and `js/schema.js` to process Marlin files, and node `fs` for file functions. Any top level code in these files runs as soon as `extension.js` does. This is when modules init their classes and export their symbols.
7878

7979
With all that done, `extension.js` defines the code that will register ABM's commands and feature providers with VSCode upon activation.
8080

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Auto Build Marlin
3-
* abm/css/infoview.css
4-
* Styles for Info sidebar panel
3+
* abm/css/docsview.css
4+
* Styles for Docs sidebar panel
55
*/
66

77
* {
@@ -18,55 +18,55 @@
1818
}
1919

2020
body.vscode-light {
21-
--abm-info-overlay-bg: white;
21+
--abm-docs-overlay-bg: white;
2222
--abm-svg-color: #00000020;
23-
--abm-info-bg: #F5F5FDC0;
24-
--abm-info-bc: #CCCCCCC0;
23+
--abm-docs-bg: #F5F5FDC0;
24+
--abm-docs-bc: #CCCCCCC0;
2525
--abm-line-hover-bg: #FFFFFFE0;
26-
--abm-info-color: black;
27-
--abm-info-color-comment: #3C2200;
28-
--abm-info-legend-color: black;
29-
--abm-info-legend-bg: #FFFA;
26+
--abm-docs-color: black;
27+
--abm-docs-color-comment: #3C2200;
28+
--abm-docs-legend-color: black;
29+
--abm-docs-legend-bg: #FFFA;
3030
--abm-item-row-bg: #FFF4;
3131
--abm-item-row-odd-bg: #FFFA;
3232
--abm-item-border-color: #000A;
3333
}
3434

3535
body.vscode-dark {
36-
--abm-info-overlay-bg: #333;
36+
--abm-docs-overlay-bg: #333;
3737
--marlin-svg: url(marlin-w.svg);
3838
--abm-svg-color: #FFFFFF20;
3939
--abm-line-hover-bg: #00000020;
40-
--abm-info-bg: #00002220;
41-
--abm-info-bc: #FFFFFF40;
42-
--abm-info-color: white;
43-
--abm-info-color-comment: #827461;
44-
--abm-info-legend-color: white;
45-
--abm-info-legend-bg: #0008;
40+
--abm-docs-bg: #00002220;
41+
--abm-docs-bc: #FFFFFF40;
42+
--abm-docs-color: white;
43+
--abm-docs-color-comment: #827461;
44+
--abm-docs-legend-color: white;
45+
--abm-docs-legend-bg: #0008;
4646
--abm-item-row-bg: #0000;
4747
--abm-item-row-odd-bg: #FFF2;
4848
--abm-item-border-color: #FFFA;
4949
}
5050

5151
body.vscode-high-contrast {
52-
--abm-info-overlay-bg: #2A2;
52+
--abm-docs-overlay-bg: #2A2;
5353
--marlin-svg: url(marlin-w.svg);
5454
--abm-svg-color: #FFFFFF20;
5555
--abm-line-hover-bg: #00000030;
56-
--abm-info-bg: #282C34AA;
57-
--abm-info-bc: #CCCCCCC0;
58-
--abm-info-color: white;
59-
--abm-info-color-comment: #827461;
60-
--abm-info-legend-color: yellow;
61-
--abm-info-legend-bg: #009;
56+
--abm-docs-bg: #282C34AA;
57+
--abm-docs-bc: #CCCCCCC0;
58+
--abm-docs-color: white;
59+
--abm-docs-color-comment: #827461;
60+
--abm-docs-legend-color: yellow;
61+
--abm-docs-legend-bg: #009;
6262
--abm-item-row-bg: black;
6363
--abm-item-row-odd-bg: #226;
6464
--abm-item-border-color: white;
6565
}
6666
body.vscode-high-contrast-light {
67-
--abm-info-overlay-bg: #AFA;
68-
--abm-info-legend-color: #009;
69-
--abm-info-legend-bg: #FF0;
67+
--abm-docs-overlay-bg: #AFA;
68+
--abm-docs-legend-color: #009;
69+
--abm-docs-legend-bg: #FF0;
7070
--abm-item-row-bg: #FFF;
7171
--abm-item-row-odd-bg: #DDF;
7272
--abm-item-border-color: black;
@@ -116,7 +116,7 @@ pre {
116116
padding: 4px 0;
117117
margin-bottom: 4px;
118118
border-radius: 1em;
119-
color: var(--abm-info-color);
119+
color: var(--abm-docs-color);
120120
}
121121
h2.gcode {background: var(--color-h2-gcode);}
122122
h2.basics { background: var(--color-h2-basics); }
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
// ]]>
1515
</script>
1616
<script nonce="${ nonce }" src="${ vsviewUri }"></script>
17-
<script nonce="${ nonce }" src="${ schemaUri }"></script>
1817
<script nonce="${ nonce }" src="${ jqueryUri }"></script>
1918
<script nonce="${ nonce }" src="${ scriptUri }"></script>
20-
<title>Marlin Info</title>
19+
<title>Marlin Docs</title>
2120
</head>
22-
<body id="abm-info">
21+
<body id="abm-docs">
2322
<!-- Based on marlinfw.org live site search page -->
2423

2524
<div id="search" class="container" role="main">
Lines changed: 35 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,38 @@
11
/**
2-
* abm/info.js
2+
* abm/docs.js
33
*
4-
* Provider for the Marlin Info sidebar.
4+
* Provider for the Marlin Docs sidebar.
55
* Loads at extension startup.
66
*
77
* This provider:
8-
* - Sets up the initial webview for the Marlin Info sidebar.
9-
* - Handles commands sent by the Info webview.
10-
* - Sends messages to the Info webview when something changes.
8+
* - Sets up the initial webview for the Marlin Docs sidebar.
9+
* - Handles commands sent by the Docs webview.
10+
* - Sends messages to the Docs webview when something changes.
1111
*
12-
* The Info Panel displays the same information as the Build Panel.
13-
* Code developed for this panel may later be applied to all parts
14-
* of ABM for display of configuration info.
12+
* The Docs Panel downloads the marlinfw.org search index and
13+
* displays a search field to find terms in the index.
14+
* Search results are displayed in a list with links to the website.
1515
*/
1616
'use strict';
1717

1818
const vscode = require("vscode"),
19-
fs = require('fs'),
2019
abm = require('./abm'),
21-
marlin = require('./js/marlin'),
22-
schema = require('./js/schema'),
2320
vw = vscode.window;
2421

25-
// Get the schema for the display and manipulation of configuration info
26-
const ConfigSchema = schema.ConfigSchema;
27-
var schemas;
28-
2922
const jsonFeedUrl = 'https://marlinfw.org/feeds/feed.json';
30-
class InfoPanelProvider {
23+
class DocsPanelProvider {
3124

3225
constructor(context) { this.context = context; }
3326

3427
// Called by extension.js to register the provider.
3528
static register(context) {
36-
const provider = new InfoPanelProvider(context);
37-
return vw.registerWebviewViewProvider(InfoPanelProvider.viewType, provider);
29+
const provider = new DocsPanelProvider(context);
30+
return vw.registerWebviewViewProvider(DocsPanelProvider.viewType, provider);
3831
}
3932

40-
// Called when the info pane is revealed.
33+
// Called when the Docs pane is revealed.
4134
async resolveWebviewView(wvv, wvContext, _token) {
42-
//console.log("InfoPanelProvider.resolveWebviewView"); console.dir(wvv);
35+
//console.log("DocsPanelProvider.resolveWebviewView"); console.dir(wvv);
4336

4437
this._view = wvv; // Take ownership of the webview view.
4538

@@ -52,36 +45,33 @@ class InfoPanelProvider {
5245
wv.html = await this.getWebViewHtml(wv);
5346

5447
// Handle show/hide events.
55-
wvv.onDidChangeVisibility(() => {
56-
abm.log(`InfoPanelProvider.onDidChangeVisibility: ${wvv.visible}`);
57-
});
48+
//wvv.onDidChangeVisibility(() => {
49+
// abm.log(`DocsPanelProvider.onDidChangeVisibility: ${wvv.visible}`);
50+
//});
5851

5952
// Let go of the webview view when it is closed.
6053
wvv.onDidDispose(() => {
61-
abm.log("InfoPanelProvider.onDidDispose:");
54+
abm.log("DocsPanelProvider.onDidDispose:");
6255
this._view = undefined;
6356
});
6457

6558
// Receive message from the webview.
66-
function handleMessageFromUI(m) {
67-
abm.log('InfoPanelProvider::handleMessageFromUI', m);
68-
switch (m.type) {
69-
case 'hello':
70-
vw.showInformationMessage('Hello from the webview!');
71-
break;
72-
}
73-
}
74-
wv.onDidReceiveMessage(handleMessageFromUI);
59+
//function handleMessageFromUI(m) {
60+
// abm.log('DocsPanelProvider::handleMessageFromUI', m);
61+
// switch (m.type) {
62+
// case 'hello':
63+
// vw.showInformationMessage('Hello from the webview!');
64+
// break;
65+
// }
66+
//}
67+
//wv.onDidReceiveMessage(handleMessageFromUI);
7568

7669
// Tell the webview to display something
77-
// Received by infoview.js:handleMessageToUI
70+
// Received by docsview.js:handleMessageToUI
7871
function updateWebview() {
79-
wv.postMessage({ type: 'say', text: "hello" }); // infoview.js:handleMessageToUI
72+
wv.postMessage({ type: 'say', text: "hello" }); // docsview.js:handleMessageToUI
8073
}
8174

82-
schemas = schema.combinedSchema(marlin, fs);
83-
abm.log("abm/info.js", schemas);
84-
8575
// Update the view now that the pane has been revealed.
8676
updateWebview();
8777
}
@@ -105,28 +95,27 @@ class InfoPanelProvider {
10595
}
10696

10797
/**
108-
* Static HTML as the starting point for info webviews.
98+
* Static HTML as the starting point for the docs webview.
10999
* Attached scripts are invoked in the webview's context.
110100
*/
111101
async getWebViewHtml(webview) {
112102
// Local path to script and css for the webview
113103
const nonce = abm.getNonce(), // Use a nonce to whitelist which scripts can be run
114104
jqueryUri = this.jsUri(webview, 'jquery-3.6.0.min.js'),
115105
vsviewUri = this.jsUri(webview, 'vsview.js'),
116-
schemaUri = this.jsUri(webview, 'schema.js'),
117-
scriptUri = this.jsUri(webview, 'infoview.js'),
118-
cssUri = this.resourceUri(webview, 'css', 'infoview.css'),
106+
scriptUri = this.jsUri(webview, 'docsview.js'),
107+
cssUri = this.resourceUri(webview, 'css', 'docsview.css'),
119108
_searchData = (await this.fetchMarlinSiteIndex()).replaceAll('`', '\\`');
120109

121-
const merged_html = eval(`\`${ abm.load_html('info.html') }\``);
110+
const merged_html = eval(`\`${ abm.load_html('docs.html') }\``);
122111
return merged_html;
123112
}
124113
}
125114

126115
// Static members
127-
InfoPanelProvider.viewType = 'abm.infoView';
116+
DocsPanelProvider.viewType = 'abm.docsView';
128117

129118
// Export the provider
130-
exports.InfoPanelProvider = InfoPanelProvider;
119+
exports.DocsPanelProvider = DocsPanelProvider;
131120

132-
abm.log("InfoPanelProvider (info.js) loaded");
121+
abm.log("DocsPanelProvider (docs.js) loaded");
Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
22
* Auto Build Marlin
3-
* abm/js/infoview.js
3+
* abm/js/docsview.js
44
*
55
* This script runs when the view is created / revealed.
66
*
77
* The webview already contains the base HTML, so we:
8-
* - Set up the initial info webview.
8+
* - Set up the initial docs webview.
99
*/
1010
'use strict';
1111

@@ -222,15 +222,12 @@ $(function () {
222222
var verbose = false;
223223
function log(message, data) {
224224
if (!verbose) return;
225-
console.log(`[editview] ${message}`);
225+
console.log(`[docsview] ${message}`);
226226
if (data !== undefined) console.dir(data);
227227
}
228228

229-
// References to elements in the webview.
230-
const $element = $('#element');
231-
232229
// Set up the view anew.
233-
function initInfoView() {
230+
function initDocsView() {
234231
// Fetch the marlinfw.org site index
235232
marlinfwSearch.init();
236233
}
@@ -249,12 +246,12 @@ $(function () {
249246
* @param {object} message - The message object.
250247
*/
251248
function handleMessageToUI(m) {
252-
log("infoview.js : handleMessageToUI", m);
249+
log("docsview.js : handleMessageToUI", m);
253250
switch (m.type) {
254251
// Update the whole form in response to an external change.
255-
case 'info':
256-
//drawInfo(m.data);
257-
break;
252+
//case 'say':
253+
// showtext(m.text);
254+
// break;
258255

259256
// Display an error message
260257
case 'error':
@@ -272,18 +269,18 @@ $(function () {
272269
//
273270

274271
// Create elements, add handlers, fill in initial info, etc.
275-
initInfoView();
272+
initDocsView();
276273

277274
//
278-
// Info Panel Revealed
275+
// Docs Panel Revealed
279276
//
280-
// If there is state data then we can skip the parser and build the form.
277+
// If there is state data then apply it to the view, e.g., to preserve the filter text.
281278
const state = vscode.getState();
282279
if (state) {
283280
log("Got VSCode state", state);
284281
if ('data' in state) {
285-
log("Init Marlin Info Webview with stored data")
286-
initInfoView();
282+
log("Init Marlin Docs Webview with stored data")
283+
initDocsView();
287284
}
288285
}
289286

β€Žextension.jsβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const vscode = require('vscode'),
1010
abm = require('./abm/abm'),
1111
prefs = require('./abm/prefs'),
1212
format = require('./abm/format'),
13-
info = require('./abm/info'),
13+
docs = require('./abm/docs'),
1414
editor = require('./abm/editor');
1515

1616
exports.activate = (context) => {
@@ -33,8 +33,8 @@ exports.activate = (context) => {
3333
vc.registerCommand('abm.export.yml', () => { abm.run_schema_py('yml'); }),
3434
vc.registerCommand('abm.apply.ini', () => { abm.run_configuration_py(); }),
3535

36-
// Register a webview provider for the Info panel
37-
info.InfoPanelProvider.register(context),
36+
// Register a webview provider for the Docs panel
37+
docs.DocsPanelProvider.register(context),
3838

3939
// Formatter to do an extra level of indentation for Marlin C++.
4040
format.PPFormatProvider.register(context),

0 commit comments

Comments
Β (0)