Skip to content

Commit c3eaca0

Browse files
author
Akos Kitta
committed
fix: different validation rule for cached sketches
Signed-off-by: Akos Kitta <[email protected]>
1 parent 23d5bea commit c3eaca0

32 files changed

+108
-65
lines changed

arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
SketchesService,
2424
SketchesServicePath,
2525
} from '../common/protocol/sketches-service';
26-
import { SketchesServiceClientImpl } from '../common/protocol/sketches-service-client-impl';
26+
import { SketchesServiceClientImpl } from './sketches-service-client-impl';
2727
import { CoreService, CoreServicePath } from '../common/protocol/core-service';
2828
import { BoardsListWidget } from './boards/boards-list-widget';
2929
import { BoardsListWidgetFrontendContribution } from './boards/boards-widget-frontend-contribution';

arduino-ide-extension/src/browser/contributions/add-file.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from './contribution';
1212
import { FileDialogService } from '@theia/filesystem/lib/browser';
1313
import { nls } from '@theia/core/lib/common';
14-
import { CurrentSketch } from '../../common/protocol/sketches-service-client-impl';
14+
import { CurrentSketch } from '../sketches-service-client-impl';
1515

1616
@injectable()
1717
export class AddFile extends SketchContribution {

arduino-ide-extension/src/browser/contributions/archive-sketch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
MenuModelRegistry,
1010
} from './contribution';
1111
import { nls } from '@theia/core/lib/common';
12-
import { CurrentSketch } from '../../common/protocol/sketches-service-client-impl';
12+
import { CurrentSketch } from '../sketches-service-client-impl';
1313

1414
@injectable()
1515
export class ArchiveSketch extends SketchContribution {

arduino-ide-extension/src/browser/contributions/close.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
URI,
2121
} from './contribution';
2222
import { Dialog } from '@theia/core/lib/browser/dialogs';
23-
import { CurrentSketch } from '../../common/protocol/sketches-service-client-impl';
23+
import { CurrentSketch } from '../sketches-service-client-impl';
2424
import { SaveAsSketch } from './save-as-sketch';
2525

2626
/**

arduino-ide-extension/src/browser/contributions/contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import { SettingsService } from '../dialogs/settings/settings';
4141
import {
4242
CurrentSketch,
4343
SketchesServiceClientImpl,
44-
} from '../../common/protocol/sketches-service-client-impl';
44+
} from '../sketches-service-client-impl';
4545
import {
4646
SketchesService,
4747
FileSystemExt,

arduino-ide-extension/src/browser/contributions/create-contribution.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { CompositeTreeNode } from '@theia/core/lib/browser';
22
import { nls } from '@theia/core/lib/common/nls';
3-
import URI from '@theia/core/lib/common/uri';
43
import { inject, injectable } from '@theia/core/shared/inversify';
5-
import { Sketch } from '../../common/protocol';
64
import { CreateApi } from '../create/create-api';
75
import { CreateFeatures } from '../create/create-features';
86
import { CreateUri } from '../create/create-uri';
97
import { Create, isNotFound } from '../create/typings';
10-
import { LocalCacheFsProvider } from '../local-cache/local-cache-fs-provider';
118
import { CloudSketchbookTree } from '../widgets/cloud-sketchbook/cloud-sketchbook-tree';
129
import { CloudSketchbookTreeModel } from '../widgets/cloud-sketchbook/cloud-sketchbook-tree-model';
1310
import { CloudSketchbookTreeWidget } from '../widgets/cloud-sketchbook/cloud-sketchbook-tree-widget';
@@ -51,28 +48,13 @@ export function pushingSketch(input: string): string {
5148

5249
@injectable()
5350
export abstract class CloudSketchContribution extends SketchContribution {
54-
@inject(LocalCacheFsProvider)
55-
private readonly localCacheFsProvider: LocalCacheFsProvider;
5651
@inject(SketchbookWidgetContribution)
5752
private readonly widgetContribution: SketchbookWidgetContribution;
5853
@inject(CreateApi)
5954
protected readonly createApi: CreateApi;
6055
@inject(CreateFeatures)
6156
protected readonly createFeatures: CreateFeatures;
6257

63-
protected cloudUri(sketch: Sketch): URI | undefined {
64-
return this.localCacheFsProvider.from(new URI(sketch.uri));
65-
}
66-
67-
protected localCacheUri(cloudUri: URI): URI | undefined {
68-
if (cloudUri.scheme !== CreateUri.scheme) {
69-
throw new Error(
70-
`Expected '${CreateUri.scheme}'. Got ${cloudUri.toString()}`
71-
);
72-
}
73-
return this.localCacheFsProvider.to(cloudUri);
74-
}
75-
7658
protected async treeModel(): Promise<
7759
(CloudSketchbookTreeModel & { root: CompositeTreeNode }) | undefined
7860
> {

arduino-ide-extension/src/browser/contributions/debug.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
TabBarToolbarRegistry,
1919
} from './contribution';
2020
import { MaybePromise, MenuModelRegistry, nls } from '@theia/core/lib/common';
21-
import { CurrentSketch } from '../../common/protocol/sketches-service-client-impl';
21+
import { CurrentSketch } from '../sketches-service-client-impl';
2222
import { ArduinoMenus } from '../menu/arduino-menus';
2323

2424
const COMPILE_FOR_DEBUG_KEY = 'arduino-compile-for-debug';

arduino-ide-extension/src/browser/contributions/delete-sketch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class DeleteSketch extends CloudSketchContribution {
5959
if (!willNavigateAway) {
6060
return this.sketchesService.deleteSketch(sketch);
6161
}
62-
const cloudUri = this.cloudUri(sketch); // TODO: warn user that it's a cloud sketch
62+
const cloudUri = this.createFeatures.cloudUri(sketch); // TODO: warn user that it's a cloud sketch
6363
if (willNavigateAway !== 'force') {
6464
const { response } = await remote.dialog.showMessageBox({
6565
title: nls.localizeByDefault('Delete'),

arduino-ide-extension/src/browser/contributions/include-library.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { SketchContribution, Command, CommandRegistry } from './contribution';
1717
import { NotificationCenter } from '../notification-center';
1818
import { nls } from '@theia/core/lib/common';
1919
import * as monaco from '@theia/monaco-editor-core';
20-
import { CurrentSketch } from '../../common/protocol/sketches-service-client-impl';
20+
import { CurrentSketch } from '../sketches-service-client-impl';
2121

2222
@injectable()
2323
export class IncludeLibrary extends SketchContribution {

arduino-ide-extension/src/browser/contributions/ino-language.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
ExecutableService,
99
sanitizeFqbn,
1010
} from '../../common/protocol';
11-
import { CurrentSketch } from '../../common/protocol/sketches-service-client-impl';
11+
import { CurrentSketch } from '../sketches-service-client-impl';
1212
import { BoardsConfig } from '../boards/boards-config';
1313
import { BoardsServiceProvider } from '../boards/boards-service-provider';
1414
import { HostedPluginEvents } from '../hosted-plugin-events';

0 commit comments

Comments
 (0)