feat: rename, deletion, and validation support

Closes #1599
Closes #1825
Closes #649
Closes #1847
Closes #1882

Co-authored-by: Akos Kitta <a.kitta@arduino.cc>
Co-authored-by: per1234 <accounts@perglass.com>

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
Akos Kitta
2023-01-17 14:03:07 +01:00
committed by Akos Kitta
parent 4f07515ee8
commit d68bc4abdb
71 changed files with 2905 additions and 874 deletions

View File

@@ -344,7 +344,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
MonitorServiceName,
].forEach((name) => bindChildLogger(bind, name));
// Remote sketchbook bindings
// Cloud sketchbook bindings
bind(AuthenticationServiceImpl).toSelf().inSingletonScope();
bind(AuthenticationService).toService(AuthenticationServiceImpl);
bind(BackendApplicationContribution).toService(AuthenticationServiceImpl);

View File

@@ -7,7 +7,6 @@ import {
BoardsPackage,
Board,
BoardDetails,
Tool,
ConfigOption,
ConfigValue,
Programmer,
@@ -99,14 +98,11 @@ export class BoardsServiceImpl
const debuggingSupported = detailsResp.getDebuggingSupported();
const requiredTools = detailsResp.getToolsDependenciesList().map(
(t) =>
<Tool>{
name: t.getName(),
packager: t.getPackager(),
version: t.getVersion(),
}
);
const requiredTools = detailsResp.getToolsDependenciesList().map((t) => ({
name: t.getName(),
packager: t.getPackager(),
version: t.getVersion(),
}));
const configOptions = detailsResp.getConfigOptionsList().map(
(c) =>

View File

@@ -1,5 +1,5 @@
import { injectable, inject, named } from '@theia/core/shared/inversify';
import { promises as fs, realpath, lstat, Stats, constants, rm } from 'fs';
import { promises as fs, realpath, lstat, Stats, constants } from 'fs';
import * as os from 'os';
import * as temp from 'temp';
import * as path from 'path';
@@ -427,6 +427,10 @@ export class SketchesServiceImpl
return this.doLoadSketch(FileUri.create(sketchDir).toString(), false);
}
defaultInoContent(): Promise<string> {
return this.loadInoContent();
}
/**
* Creates a temp folder and returns with a promise that resolves with the canonicalized absolute pathname of the newly created temp folder.
* This method ensures that the file-system path pointing to the new temp directory is fully resolved.
@@ -628,21 +632,6 @@ export class SketchesServiceImpl
return folderName;
}
async deleteSketch(sketch: Sketch): Promise<void> {
return new Promise<void>((resolve, reject) => {
const sketchPath = FileUri.fsPath(sketch.uri);
rm(sketchPath, { recursive: true, maxRetries: 5 }, (error) => {
if (error) {
this.logger.error(`Failed to delete sketch at ${sketchPath}.`, error);
reject(error);
} else {
this.logger.info(`Successfully deleted sketch at ${sketchPath}.`);
resolve();
}
});
});
}
// Returns the default.ino from the settings or from default folder.
private async readSettings(): Promise<Record<string, unknown> | undefined> {
const configDirUri = await this.envVariableServer.getConfigDirUri();