feat: handle when starting debug session failed (#1809)

If the sketch has not been verified, IDE2 offers the user a verify action.

Closes #808

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
Akos Kitta
2023-01-23 09:03:49 +01:00
committed by GitHub
parent afb02da806
commit 6140ae525c
7 changed files with 126 additions and 16 deletions

View File

@@ -105,6 +105,17 @@ export interface SketchesService {
* Recursively deletes the sketch folder with all its content.
*/
deleteSketch(sketch: Sketch): Promise<void>;
/**
* This is the JS/TS re-implementation of [`GenBuildPath`](https://github.com/arduino/arduino-cli/blob/c0d4e4407d80aabad81142693513b3306759cfa6/arduino/sketch/sketch.go#L296-L306) of the CLI.
* Pass in a sketch and get the build temporary folder filesystem path calculated from the main sketch file location. Can be multiple ones. This method does not check the existence of the sketch.
*
* The case sensitivity of the drive letter on Windows matters when the CLI calculates the MD5 hash of the temporary build folder.
* IDE2 does not know and does not want to rely on how the CLI treats the paths: with lowercase or uppercase drive letters.
* Hence, IDE2 has to provide multiple build paths on Windows. This hack will be obsolete when the CLI can provide error codes:
* https://github.com/arduino/arduino-cli/issues/1762.
*/
tempBuildPath(sketch: Sketch): Promise<string[]>;
}
export interface SketchRef {

View File

@@ -13,6 +13,10 @@ export function firstToUpperCase(what: string): string {
return what.charAt(0).toUpperCase() + what.slice(1);
}
export function isNullOrUndefined(what: any): what is undefined | null {
export function startsWithUpperCase(what: string): boolean {
return !!what && what.charAt(0) === firstToUpperCase(what.charAt(0));
}
export function isNullOrUndefined(what: unknown): what is undefined | null {
return what === undefined || what === null;
}