@@ -2,7 +2,6 @@ import { SketchCache } from './cloud-sketch-cache';
2
2
import { inject , injectable } from '@theia/core/shared/inversify' ;
3
3
import URI from '@theia/core/lib/common/uri' ;
4
4
import { MaybePromise } from '@theia/core/lib/common/types' ;
5
- import { FileService } from '@theia/filesystem/lib/browser/file-service' ;
6
5
import { FileStatNode } from '@theia/filesystem/lib/browser/file-tree' ;
7
6
import { Command } from '@theia/core/lib/common/command' ;
8
7
import { WidgetDecoration } from '@theia/core/lib/browser/widget-decoration' ;
@@ -28,8 +27,6 @@ import { CloudSketchbookCommands } from './cloud-sketchbook-contributions';
28
27
import { DoNotAskAgainConfirmDialog } from '../../dialogs/do-not-ask-again-dialog' ;
29
28
import { SketchbookTree } from '../sketchbook/sketchbook-tree' ;
30
29
import { firstToUpperCase } from '../../../common/utils' ;
31
- import { ArduinoPreferences } from '../../arduino-preferences' ;
32
- import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl' ;
33
30
import { FileStat } from '@theia/filesystem/lib/common/files' ;
34
31
import { WorkspaceNode } from '@theia/navigator/lib/browser/navigator-tree' ;
35
32
import { posix , splitSketchPath } from '../../create/create-paths' ;
@@ -46,29 +43,20 @@ type FilesToSync = {
46
43
} ;
47
44
@injectable ( )
48
45
export class CloudSketchbookTree extends SketchbookTree {
49
- @inject ( FileService )
50
- protected override readonly fileService : FileService ;
51
-
52
46
@inject ( LocalCacheFsProvider )
53
- protected readonly localCacheFsProvider : LocalCacheFsProvider ;
47
+ private readonly localCacheFsProvider : LocalCacheFsProvider ;
54
48
55
49
@inject ( SketchCache )
56
- protected readonly sketchCache : SketchCache ;
57
-
58
- @inject ( ArduinoPreferences )
59
- protected override readonly arduinoPreferences : ArduinoPreferences ;
50
+ private readonly sketchCache : SketchCache ;
60
51
61
52
@inject ( PreferenceService )
62
- protected readonly preferenceService : PreferenceService ;
53
+ private readonly preferenceService : PreferenceService ;
63
54
64
55
@inject ( MessageService )
65
- protected readonly messageService : MessageService ;
66
-
67
- @inject ( SketchesServiceClientImpl )
68
- protected readonly sketchServiceClient : SketchesServiceClientImpl ;
56
+ private readonly messageService : MessageService ;
69
57
70
58
@inject ( CreateApi )
71
- protected readonly createApi : CreateApi ;
59
+ private readonly createApi : CreateApi ;
72
60
73
61
async pushPublicWarn (
74
62
node : CloudSketchbookTree . CloudSketchDirNode
@@ -93,15 +81,13 @@ export class CloudSketchbookTree extends SketchbookTree {
93
81
PreferenceScope . User
94
82
) ,
95
83
} ) . open ( ) ;
96
- if ( ! ok ) {
97
- return false ;
98
- }
99
- return true ;
84
+ return Boolean ( ok ) ;
100
85
} else {
101
86
return true ;
102
87
}
103
88
}
104
89
90
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
105
91
async pull ( arg : any ) : Promise < void > {
106
92
const {
107
93
// model,
@@ -136,6 +122,7 @@ export class CloudSketchbookTree extends SketchbookTree {
136
122
return ;
137
123
}
138
124
}
125
+ // this.sketchCache.init();
139
126
return this . runWithState ( node , 'pulling' , async ( node ) => {
140
127
const commandsCopy = node . commands ;
141
128
node . commands = [ ] ;
@@ -229,7 +216,7 @@ export class CloudSketchbookTree extends SketchbookTree {
229
216
} ) ;
230
217
}
231
218
232
- async recursiveURIs ( uri : URI ) : Promise < URI [ ] > {
219
+ private async recursiveURIs ( uri : URI ) : Promise < URI [ ] > {
233
220
// remote resources can be fetched one-shot via api
234
221
if ( CreateUri . is ( uri ) ) {
235
222
const resources = await this . createApi . readDirectory (
@@ -286,15 +273,15 @@ export class CloudSketchbookTree extends SketchbookTree {
286
273
} , { } ) ;
287
274
}
288
275
289
- async getUrisMap ( uri : URI ) {
276
+ private async getUrisMap ( uri : URI ) : Promise < Record < string , URI > > {
290
277
const basepath = uri . toString ( ) ;
291
278
const exists = await this . fileService . exists ( uri ) ;
292
279
const uris =
293
280
( exists && this . URIsToMap ( await this . recursiveURIs ( uri ) , basepath ) ) || { } ;
294
281
return uris ;
295
282
}
296
283
297
- async treeDiff ( source : URI , dest : URI ) : Promise < FilesToSync > {
284
+ private async treeDiff ( source : URI , dest : URI ) : Promise < FilesToSync > {
298
285
const [ sourceURIs , destURIs ] = await Promise . all ( [
299
286
this . getUrisMap ( source ) ,
300
287
this . getUrisMap ( dest ) ,
@@ -356,7 +343,7 @@ export class CloudSketchbookTree extends SketchbookTree {
356
343
}
357
344
}
358
345
359
- async sync ( source : URI , dest : URI ) {
346
+ private async sync ( source : URI , dest : URI ) : Promise < void > {
360
347
const { filesToWrite, filesToDelete } = await this . treeDiff ( source , dest ) ;
361
348
await Promise . all (
362
349
filesToWrite . map ( async ( { source, dest } ) => {
@@ -375,7 +362,9 @@ export class CloudSketchbookTree extends SketchbookTree {
375
362
) ;
376
363
}
377
364
378
- override async resolveChildren ( parent : CompositeTreeNode ) : Promise < TreeNode [ ] > {
365
+ override async resolveChildren (
366
+ parent : CompositeTreeNode
367
+ ) : Promise < TreeNode [ ] > {
379
368
return ( await super . resolveChildren ( parent ) ) . sort ( ( a , b ) => {
380
369
if (
381
370
WorkspaceNode . is ( parent ) &&
@@ -453,6 +442,7 @@ export class CloudSketchbookTree extends SketchbookTree {
453
442
if ( ! CreateUri . is ( childFs . resource ) ) {
454
443
let refUri = node . fileStat . resource ;
455
444
if ( node . fileStat . hasOwnProperty ( 'remoteUri' ) ) {
445
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
456
446
refUri = ( node . fileStat as any ) . remoteUri ;
457
447
}
458
448
remoteUri = refUri . resolve ( childFs . name ) ;
@@ -471,6 +461,7 @@ export class CloudSketchbookTree extends SketchbookTree {
471
461
}
472
462
473
463
protected override toNode (
464
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
474
465
fileStat : any ,
475
466
parent : CompositeTreeNode
476
467
) : FileNode | DirNode {
@@ -621,6 +612,7 @@ export class CloudSketchbookTree extends SketchbookTree {
621
612
if ( DecoratedTreeNode . is ( node ) ) {
622
613
for ( const property of Object . keys ( decorationData ) ) {
623
614
if ( node . decorationData . hasOwnProperty ( property ) ) {
615
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
624
616
delete ( node . decorationData as any ) [ property ] ;
625
617
}
626
618
}
0 commit comments