-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: set default for supported manufacturers
- Loading branch information
1 parent
b1e031c
commit 4dcaa19
Showing
4 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const { SerialPort } = require("serialport"); | ||
const vscode = require("vscode"); | ||
const { serializeKeyValuePairs } = require("../utils/misc"); | ||
|
||
/** | ||
* @implements {vscode.TextDocumentContentProvider} | ||
*/ | ||
class TextDocumentProvider { | ||
/** | ||
* @param {PyMakr} pymakr | ||
*/ | ||
constructor(pymakr) { | ||
this.pymakr = pymakr; | ||
} | ||
|
||
provideTextDocumentContent(uri) { | ||
const doc = this.paths[uri.path]; | ||
if(typeof doc === 'undefined') throw new Error('could not find pymakr document: ' + uri.toString()) | ||
return doc() | ||
} | ||
|
||
paths = { | ||
'Pymakr: available devices': async () => { | ||
const devices = await SerialPort.list(); | ||
const devicesStr = devices.map((e) => serializeKeyValuePairs(e)).join("\r\n\r\n"); | ||
|
||
return devicesStr; | ||
}, | ||
}; | ||
} | ||
|
||
module.exports = { TextDocumentProvider }; |