From 52908b758669effac7f8daca2bde6290b1177916 Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Wed, 22 Mar 2023 10:59:55 +0100 Subject: [PATCH 1/2] fix: use CLI config path for debug command If the `directories.data` is not the default, debug metadata generation can fail with false positive missing platform error. Ref: arduino/arduino-ide#1911 Signed-off-by: Akos Kitta --- src/extension.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index df4eb58..3d1a46b 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1,5 +1,6 @@ import * as path from 'path'; import { promises as fs } from 'fs'; +import { homedir } from 'os'; import { spawn } from 'child_process'; import deepEqual from 'deep-equal'; import WebRequest from 'web-request'; @@ -44,6 +45,10 @@ interface DebugConfig { * If not defined, it falls back to `sketchPath/.vscode/launch.json`. */ readonly configPath?: string; + /** + * Absolute path to the `arduino-cli.yaml` file. If not specified, it falls back to `~/.arduinoIDE/arduino-cli.yaml`. + */ + readonly cliConfigPath?: string; } interface DebugInfo { @@ -133,10 +138,15 @@ async function exec(command: string, args: string[]): Promise<{ stdout: string, }); } +function resolveCliConfigPath(config: DebugConfig): string { + return config.cliConfigPath ?? path.join(homedir(), '.arduinoIDE', 'arduino-cli.yaml'); +} + async function startDebug(_: ExtensionContext, config: DebugConfig): Promise { + const cliConfigPath = resolveCliConfigPath(config); let info: DebugInfo | undefined = undefined; try { - const args = ['debug', '-I', '-b', config.board.fqbn, config.sketchPath, '--format', 'json']; + const args = ['debug', '-I', '-b', config.board.fqbn, config.sketchPath, '--format', 'json', '--config-file', cliConfigPath]; const { stdout, stderr } = await exec(config?.cliPath || '.', args); if (!stdout && stderr) { throw new Error(stderr); From e18f70ecfca16142dd779ac8740f85c1628a25cb Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Wed, 22 Mar 2023 11:00:35 +0100 Subject: [PATCH 2/2] chore: bumped the version for next release Signed-off-by: Akos Kitta --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ee56086..e41453f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vscode-arduino-tools", "private": true, - "version": "0.0.2-beta.7", + "version": "0.0.2-beta.8", "publisher": "arduino", "license": "Apache-2.0", "author": "Arduino SA",