PROEDITOR-53: Changed the way we set the workspace

Got rid of the `sketch` search parameter from the URL.

Rules:
 - Get the desired workspace location from the
  - `Path` defined as the `window.location.hash` of the URL,
  - most recent workspaces,
  - most recent sketches from the default sketch folder.
 - Validate the location.
 - If no valid location was found, create a new sketch in the default sketch folder.

Note: when validating the location of the workspace root, the root must always exist. However, when in pro-mode, the desired workspace root must
not be a sketch directory with the `.ino` file, but can be any existing location.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta
2019-10-22 14:59:31 +02:00
parent de1f341d19
commit fb6785c5d3
6 changed files with 160 additions and 115 deletions

View File

@@ -3,11 +3,15 @@ export const SketchesService = Symbol('SketchesService');
export interface SketchesService {
/**
* Returns with the direct sketch folders from the location of the `fileStat`.
* The sketches returns with inverchronological order, the first item is the most recent one.
* The sketches returns with inverse-chronological order, the first item is the most recent one.
*/
getSketches(uri?: string): Promise<Sketch[]>
getSketchFiles(uri: string): Promise<string[]>
createNewSketch(parentUri: string): Promise<Sketch>
/**
* Creates a new sketch folder in the `parentUri` location. If `parentUri` is not specified,
* it falls back to the default `sketchDirUri` from the CLI.
*/
createNewSketch(parentUri?: string): Promise<Sketch>
isSketchFolder(uri: string): Promise<boolean>
}