diff --git a/.gitignore b/.gitignore index 8c8220a..5fe00fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ out node_modules .vscode-test/ -.vsix +*.vsix diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 15beb96..49d1fb6 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -30,6 +30,13 @@ "problemMatcher": [ "$tsc-watch" ] + }, + { + "type": "npm", + "script": "vscode:prepublish", + "problemMatcher": [ + "$tsc" + ] } ] } \ No newline at end of file diff --git a/src/extension.ts b/src/extension.ts index b3764e1..c25ee93 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -30,14 +30,14 @@ export function activate(context: vscode.ExtensionContext) { flashIcon = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left); flashIcon.text = `$(circuit-board) flash`; - flashIcon.tooltip = 'Flash complied mbed binary into board'; + flashIcon.tooltip = 'Flash compiled mbed binary into board'; flashIcon.command = 'extension.mbed.flash'; flashIcon.show(); logIcon = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left); logIcon.text = `$(terminal) serial monitor`; logIcon.tooltip = 'Open serial monitor'; - logIcon.command = 'extensio.mbed.serialMonitor'; + logIcon.command = 'extension.mbed.serialMonitor'; logIcon.show(); commandOutput = vscode.window.createOutputChannel('mbed tasks'); @@ -113,7 +113,7 @@ export function exec(cmd:string, cwd:string): Promise { export function checkMbedInstalled(): Promise { return new Promise((resolve, reject) => { - process = spawnCMD('which mbed'); + process = (process.platform === 'win32') ? spawnCMD('where mbed') : spawnCMD('which mbed'); process.on('close', (status) => { if (status) { reject(`error`); @@ -162,10 +162,10 @@ export function mbedCompileProject() { const cmd = generateCommand(); const folder = vscode.workspace.workspaceFolders; - const path = vscode.workspace.workspaceFolders[0].uri.path; + const path = vscode.workspace.workspaceFolders[0].uri.fsPath; exec(cmd, path) .then(() => { - vscode.window.showInformationMessage(`Successfully complied`) + vscode.window.showInformationMessage(`Successfully compiled`) }).catch((reason) => { commandOutput.appendLine(`> ERROR: ${reason}`); vscode.window.showErrorMessage(reason, 'Show Output') @@ -174,13 +174,13 @@ export function mbedCompileProject() { } export function mbedCompileAndFlashProject() { - const cmd = generateCommand(); + const cmd = generateCommand() + ' -f'; const folder = vscode.workspace.workspaceFolders; - const path = vscode.workspace.workspaceFolders[0].uri.path; + const path = vscode.workspace.workspaceFolders[0].uri.fsPath; exec(cmd, path) .then(() => { - vscode.window.showInformationMessage(`Successfully complied`) + vscode.window.showInformationMessage(`Successfully compiled`) }).catch((reason) => { commandOutput.appendLine(`> ERROR: ${reason}`); vscode.window.showErrorMessage(reason, 'Show Output')