fix: no required programmer for debug --info

Ref: arduino/arduino-cli#2540
Closes: arduino/arduino-ide#2368

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
Akos Kitta 2024-02-15 18:34:16 +01:00 committed by Akos Kitta
parent 1a98485b02
commit 4a807ab538
7 changed files with 12 additions and 27 deletions

View File

@ -169,7 +169,7 @@
], ],
"arduino": { "arduino": {
"arduino-cli": { "arduino-cli": {
"version": "0.35.2" "version": "0.35.3"
}, },
"arduino-fwuploader": { "arduino-fwuploader": {
"version": "2.4.1" "version": "2.4.1"

View File

@ -398,12 +398,9 @@ export async function isDebugEnabled(
`Failed to append boards config to the FQBN. Original FQBN was: ${fqbn}` `Failed to append boards config to the FQBN. Original FQBN was: ${fqbn}`
); );
} }
if (!data.selectedProgrammer) {
throw new Error(noProgrammerSelectedFor(board.name));
}
const params = { const params = {
fqbn: fqbnWithConfig, fqbn: fqbnWithConfig,
programmer: data.selectedProgrammer.id, programmer: data.selectedProgrammer?.id,
}; };
try { try {
const debugFqbn = await checkDebugEnabled(params); const debugFqbn = await checkDebugEnabled(params);
@ -443,13 +440,3 @@ export function debuggingNotSupported(boardName: string): string {
boardName boardName
); );
} }
/**
* (non-API)
*/
export function noProgrammerSelectedFor(boardName: string): string {
return nls.localize(
'arduino/debug/noProgrammerSelectedFor',
"No programmer selected for '{0}'",
boardName
);
}

View File

@ -95,7 +95,7 @@ export interface CheckDebugEnabledParams {
* The FQBN might contain custom board config options. For example, `arduino:esp32:nano_nora:USBMode=hwcdc,option2=value2`. * The FQBN might contain custom board config options. For example, `arduino:esp32:nano_nora:USBMode=hwcdc,option2=value2`.
*/ */
readonly fqbn: string; readonly fqbn: string;
readonly programmer: string; readonly programmer?: string;
} }
export interface BoardSearch extends Searchable.Options { export interface BoardSearch extends Searchable.Options {

View File

@ -178,7 +178,7 @@ export class BoardsServiceImpl
const req = new IsDebugSupportedRequest() const req = new IsDebugSupportedRequest()
.setInstance(instance) .setInstance(instance)
.setFqbn(fqbn) .setFqbn(fqbn)
.setProgrammer(programmer); .setProgrammer(programmer ?? '');
try { try {
const debugFqbn = await new Promise<string>((resolve, reject) => const debugFqbn = await new Promise<string>((resolve, reject) =>
client.isDebugSupported(req, (err, resp) => { client.isDebugSupported(req, (err, resp) => {

View File

@ -28,7 +28,6 @@ import {
debuggingNotSupported, debuggingNotSupported,
isDebugEnabled, isDebugEnabled,
noPlatformInstalledFor, noPlatformInstalledFor,
noProgrammerSelectedFor,
} from '../../browser/contributions/debug'; } from '../../browser/contributions/debug';
import { NotificationCenter } from '../../browser/notification-center'; import { NotificationCenter } from '../../browser/notification-center';
import { noBoardSelected } from '../../common/nls'; import { noBoardSelected } from '../../common/nls';
@ -117,20 +116,20 @@ describe('debug', () => {
); );
}); });
it('should error when no programmer selected', async () => { it('should resolve when no programmer is selected (arduino/arduino-cli#2540)', async () => {
const copyData: Mutable<BoardsDataStore.Data> = deepClone(data); const copyData: Mutable<BoardsDataStore.Data> = deepClone(data);
delete copyData.selectedProgrammer; delete copyData.selectedProgrammer;
await rejects( await doesNotReject(
isDebugEnabled( isDebugEnabled(
board, board,
() => boardDetails, () => boardDetails,
() => copyData, () => copyData,
(fqbn) => fqbn, (fqbn) => fqbn,
unexpectedCall() async (params) => {
), expect(params.programmer).to.be.undefined;
(reason) => return params.fqbn;
reason instanceof Error && }
reason.message === noProgrammerSelectedFor(board.name) )
); );
}); });

View File

@ -196,7 +196,7 @@
"theiaPlugins": { "theiaPlugins": {
"vscode-builtin-cpp": "https://open-vsx.org/api/vscode/cpp/1.52.1/file/vscode.cpp-1.52.1.vsix", "vscode-builtin-cpp": "https://open-vsx.org/api/vscode/cpp/1.52.1/file/vscode.cpp-1.52.1.vsix",
"vscode-arduino-api": "https://github.com/dankeboy36/vscode-arduino-api/releases/download/0.1.2/vscode-arduino-api-0.1.2.vsix", "vscode-arduino-api": "https://github.com/dankeboy36/vscode-arduino-api/releases/download/0.1.2/vscode-arduino-api-0.1.2.vsix",
"vscode-arduino-tools": "https://downloads.arduino.cc/vscode-arduino-tools/vscode-arduino-tools-0.1.2.vsix", "vscode-arduino-tools": "https://downloads.arduino.cc/vscode-arduino-tools/vscode-arduino-tools-0.1.3.vsix",
"vscode-builtin-json": "https://open-vsx.org/api/vscode/json/1.46.1/file/vscode.json-1.46.1.vsix", "vscode-builtin-json": "https://open-vsx.org/api/vscode/json/1.46.1/file/vscode.json-1.46.1.vsix",
"vscode-builtin-json-language-features": "https://open-vsx.org/api/vscode/json-language-features/1.46.1/file/vscode.json-language-features-1.46.1.vsix", "vscode-builtin-json-language-features": "https://open-vsx.org/api/vscode/json-language-features/1.46.1/file/vscode.json-language-features-1.46.1.vsix",
"cortex-debug": "https://downloads.arduino.cc/marus25.cortex-debug/marus25.cortex-debug-1.5.1.vsix", "cortex-debug": "https://downloads.arduino.cc/marus25.cortex-debug/marus25.cortex-debug-1.5.1.vsix",

View File

@ -213,7 +213,6 @@
"debuggingNotSupported": "Debugging is not supported by '{0}'", "debuggingNotSupported": "Debugging is not supported by '{0}'",
"getDebugInfo": "Getting debug info...", "getDebugInfo": "Getting debug info...",
"noPlatformInstalledFor": "Platform is not installed for '{0}'", "noPlatformInstalledFor": "Platform is not installed for '{0}'",
"noProgrammerSelectedFor": "No programmer selected for '{0}'",
"optimizeForDebugging": "Optimize for Debugging", "optimizeForDebugging": "Optimize for Debugging",
"sketchIsNotCompiled": "Sketch '{0}' must be verified before starting a debug session. Please verify the sketch and start debugging again. Do you want to verify the sketch now?" "sketchIsNotCompiled": "Sketch '{0}' must be verified before starting a debug session. Please verify the sketch and start debugging again. Do you want to verify the sketch now?"
}, },