Skip to content

Commit 242e084

Browse files
fix: include host info in device summary
1 parent dadb664 commit 242e084

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/providers/TextDocumentProvider.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const vscode = require("vscode");
33
const { timestamp } = require("../utils/createLogger");
44
const { arraysToMarkdownTable, adapterHistoryTable } = require("../utils/formatters");
55
const { serializeKeyValuePairs } = require("../utils/misc");
6+
const os = require("os");
67

78
/**
89
* @typedef {Object} subProvider
@@ -55,12 +56,22 @@ class TextDocumentProvider {
5556
const configTable = arraysToMarkdownTable([["Config", ""], ...Object.entries(config || {})]);
5657
const deviceTable = arraysToMarkdownTable([["Device", ""], ...Object.entries(device.raw || {})]);
5758
const systemTable = arraysToMarkdownTable([["System", ""], ...Object.entries(device.info || {})]);
59+
const hostTable = arraysToMarkdownTable([
60+
["Host", ""],
61+
...Object.entries({
62+
OS: process.platform + " - " + os.arch(),
63+
Pymakr: vscode.extensions.getExtension("Pycom.pymakr")?.packageJSON.version,
64+
"Pymakr-Preview": vscode.extensions.getExtension("Pycom.pymakr-preview")?.packageJSON.version,
65+
VSCode: vscode.version,
66+
}),
67+
]);
5868

5969
const historyTable = arraysToMarkdownTable(adapterHistoryTable(device));
6070
const body = [
6171
configTable,
6272
deviceTable,
6373
systemTable,
74+
hostTable,
6475
`## Device History at ${timestamp(new Date())}`,
6576
historyTable,
6677
].join("\r\n\r\n");

src/utils/formatters.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
const { timestamp } = require("./createLogger");
1111

1212
const sanitize = (str) =>
13-
(typeof str === "string" ? str : JSON.stringify(str, null, 2))
13+
(typeof str === "string" ? str : typeof str === "undefined" ? "undefined" : JSON.stringify(str, null, 2))
1414
.replace(/\|/gm, "|")
1515
.replace(/\r?\n/gm, "<br />")
1616
.replace(/"username": ".+?"/, '"username": "&#42;&#42;&#42;"')

0 commit comments

Comments
 (0)