Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitadf3dcf

Browse files
author
Akos Kitta
committed
feat: rename, deletion, and validation support
Closes#1599Closes#1825Closes#649Closes#1847Closes#1882Co-authored-by: Akos Kitta <a.kitta@arduino.cc>Co-authored-by: per1234 <accounts@perglass.com>Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent25b545d commitadf3dcf

File tree

71 files changed

+2895
-864
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2895
-864
lines changed

‎.vscode/launch.json‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
".",
1515
"--log-level=debug",
1616
"--hostname=localhost",
17-
"--no-cluster",
1817
"--app-project-path=${workspaceRoot}/electron-app",
1918
"--remote-debugging-port=9222",
2019
"--no-app-auto-install",
@@ -52,7 +51,6 @@
5251
".",
5352
"--log-level=debug",
5453
"--hostname=localhost",
55-
"--no-cluster",
5654
"--app-project-path=${workspaceRoot}/electron-app",
5755
"--remote-debugging-port=9222",
5856
"--no-app-auto-install",

‎arduino-ide-extension/package.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@
6767
"auth0-js":"^9.14.0",
6868
"btoa":"^1.2.1",
6969
"classnames":"^2.3.1",
70+
"cross-fetch":"^3.1.5",
7071
"dateformat":"^3.0.3",
7172
"deepmerge":"2.0.1",
7273
"electron-updater":"^4.6.5",
7374
"fast-json-stable-stringify":"^2.1.0",
7475
"fast-safe-stringify":"^2.1.1",
76+
"filename-reserved-regex":"^2.0.0",
7577
"glob":"^7.1.6",
7678
"google-protobuf":"^3.20.1",
7779
"hash.js":"^1.1.7",

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

Lines changed: 8 additions & 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';
@@ -344,6 +344,9 @@ import { DebugViewModel } from '@theia/debug/lib/browser/view/debug-view-model';
344344
import{DebugSessionWidget}from'@theia/debug/lib/browser/view/debug-session-widget';
345345
import{DebugConfigurationWidget}from'@theia/debug/lib/browser/view/debug-configuration-widget';
346346
import{ConfigServiceClient}from'./config/config-service-client';
347+
import{ValidateSketch}from'./contributions/validate-sketch';
348+
import{RenameCloudSketch}from'./contributions/rename-cloud-sketch';
349+
import{CreateFeatures}from'./create/create-features';
347350

348351
exportdefaultnewContainerModule((bind,unbind,isBound,rebind)=>{
349352
// Commands and toolbar items
@@ -729,6 +732,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
729732
Contribution.configure(bind,UpdateIndexes);
730733
Contribution.configure(bind,InterfaceScale);
731734
Contribution.configure(bind,NewCloudSketch);
735+
Contribution.configure(bind,ValidateSketch);
736+
Contribution.configure(bind,RenameCloudSketch);
732737

733738
bindContributionProvider(bind,StartupTaskProvider);
734739
bind(StartupTaskProvider).toService(BoardsServiceProvider);// to reuse the boards config in another window
@@ -889,6 +894,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
889894
);
890895
bind(CreateApi).toSelf().inSingletonScope();
891896
bind(SketchCache).toSelf().inSingletonScope();
897+
bind(CreateFeatures).toSelf().inSingletonScope();
898+
bind(FrontendApplicationContribution).toService(CreateFeatures);
892899

893900
bind(ShareSketchDialog).toSelf().inSingletonScope();
894901
bind(AuthenticationClientService).toSelf().inSingletonScope();

‎arduino-ide-extension/src/browser/config/config-service-client.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class ConfigServiceClient implements FrontendApplicationContribution {
3838
@postConstruct()
3939
protectedinit():void{
4040
this.appStateService.reachedState('ready').then(async()=>{
41-
constconfig=awaitthis.fetchConfig();
41+
constconfig=awaitthis.delegate.getConfiguration();
4242
this.use(config);
4343
});
4444
}
@@ -59,10 +59,6 @@ export class ConfigServiceClient implements FrontendApplicationContribution {
5959
returnthis.didChangeDataDirUriEmitter.event;
6060
}
6161

62-
asyncfetchConfig():Promise<ConfigState>{
63-
returnthis.delegate.getConfiguration();
64-
}
65-
6662
/**
6763
* CLI config related error messages if any.
6864
*/

‎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
exportclassAddFileextendsSketchContribution{

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

Lines changed: 2 additions & 2 deletions
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
exportclassArchiveSketchextendsSketchContribution{
@@ -56,7 +56,7 @@ export class ArchiveSketch extends SketchContribution {
5656
if(!destinationUri){
5757
return;
5858
}
59-
awaitthis.sketchService.archive(sketch,destinationUri.toString());
59+
awaitthis.sketchesService.archive(sketch,destinationUri.toString());
6060
this.messageService.info(
6161
nls.localize(
6262
'arduino/sketch/createdArchive',

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

Lines changed: 2 additions & 2 deletions
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
/**
@@ -185,7 +185,7 @@ export class Close extends SketchContribution {
185185
privateasyncisCurrentSketchTemp():Promise<false|Sketch>{
186186
constcurrentSketch=awaitthis.sketchServiceClient.currentSketch();
187187
if(CurrentSketch.isValid(currentSketch)){
188-
constisTemp=awaitthis.sketchService.isTemp(currentSketch);
188+
constisTemp=awaitthis.sketchesService.isTemp(currentSketch);
189189
if(isTemp){
190190
returncurrentSketch;
191191
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
import{CompositeTreeNode}from'@theia/core/lib/browser/tree';
2+
import{nls}from'@theia/core/lib/common/nls';
3+
import{inject,injectable}from'@theia/core/shared/inversify';
4+
import{CreateApi}from'../create/create-api';
5+
import{CreateFeatures}from'../create/create-features';
6+
import{CreateUri}from'../create/create-uri';
7+
import{Create,isNotFound}from'../create/typings';
8+
import{CloudSketchbookTree}from'../widgets/cloud-sketchbook/cloud-sketchbook-tree';
9+
import{CloudSketchbookTreeModel}from'../widgets/cloud-sketchbook/cloud-sketchbook-tree-model';
10+
import{CloudSketchbookTreeWidget}from'../widgets/cloud-sketchbook/cloud-sketchbook-tree-widget';
11+
import{SketchbookWidget}from'../widgets/sketchbook/sketchbook-widget';
12+
import{SketchbookWidgetContribution}from'../widgets/sketchbook/sketchbook-widget-contribution';
13+
import{SketchContribution}from'./contribution';
14+
15+
exportfunctionsketchAlreadyExists(input:string):string{
16+
returnnls.localize(
17+
'arduino/cloudSketch/alreadyExists',
18+
"Cloud sketch '{0}' already exists.",
19+
input
20+
);
21+
}
22+
exportfunctionsketchNotFound(input:string):string{
23+
returnnls.localize(
24+
'arduino/cloudSketch/notFound',
25+
"Could not pull the cloud sketch '{0}'. It does not exist.",
26+
input
27+
);
28+
}
29+
exportconstsynchronizingSketchbook=nls.localize(
30+
'arduino/cloudSketch/synchronizingSketchbook',
31+
'Synchronizing sketchbook...'
32+
);
33+
exportfunctionpullingSketch(input:string):string{
34+
returnnls.localize(
35+
'arduino/cloudSketch/pulling',
36+
"Synchronizing sketchbook, pulling '{0}'...",
37+
input
38+
);
39+
}
40+
exportfunctionpushingSketch(input:string):string{
41+
returnnls.localize(
42+
'arduino/cloudSketch/pushing',
43+
"Synchronizing sketchbook, pushing '{0}'...",
44+
input
45+
);
46+
}
47+
48+
@injectable()
49+
exportabstractclassCloudSketchContributionextendsSketchContribution{
50+
@inject(SketchbookWidgetContribution)
51+
privatereadonlywidgetContribution:SketchbookWidgetContribution;
52+
@inject(CreateApi)
53+
protectedreadonlycreateApi:CreateApi;
54+
@inject(CreateFeatures)
55+
protectedreadonlycreateFeatures:CreateFeatures;
56+
57+
protectedasynctreeModel():Promise<
58+
(CloudSketchbookTreeModel&{root:CompositeTreeNode})|undefined
59+
>{
60+
const{ enabled, session}=this.createFeatures;
61+
if(enabled&&session){
62+
constwidget=awaitthis.widgetContribution.widget;
63+
consttreeModel=this.treeModelFrom(widget);
64+
if(treeModel){
65+
constroot=treeModel.root;
66+
if(CompositeTreeNode.is(root)){
67+
returntreeModelasCloudSketchbookTreeModel&{
68+
root:CompositeTreeNode;
69+
};
70+
}
71+
}
72+
}
73+
returnundefined;
74+
}
75+
76+
protectedasyncpull(
77+
sketch:Create.Sketch
78+
):Promise<CloudSketchbookTree.CloudSketchDirNode|undefined>{
79+
consttreeModel=awaitthis.treeModel();
80+
if(!treeModel){
81+
returnundefined;
82+
}
83+
constid=CreateUri.toUri(sketch).path.toString();
84+
constnode=treeModel.getNode(id);
85+
if(!node){
86+
thrownewError(
87+
`Could not find cloud sketchbook tree node with ID:${id}.`
88+
);
89+
}
90+
if(!CloudSketchbookTree.CloudSketchDirNode.is(node)){
91+
thrownewError(
92+
`Cloud sketchbook tree node expected to represent a directory but it did not. Tree node ID:${id}.`
93+
);
94+
}
95+
try{
96+
awaittreeModel.sketchbookTree().pull({ node});
97+
returnnode;
98+
}catch(err){
99+
if(isNotFound(err)){
100+
awaittreeModel.refresh();
101+
this.messageService.error(sketchNotFound(sketch.name));
102+
returnundefined;
103+
}
104+
throwerr;
105+
}
106+
}
107+
108+
privatetreeModelFrom(
109+
widget:SketchbookWidget
110+
):CloudSketchbookTreeModel|undefined{
111+
for(consttreeWidgetofwidget.getTreeWidgets()){
112+
if(treeWidgetinstanceofCloudSketchbookTreeWidget){
113+
constmodel=treeWidget.model;
114+
if(modelinstanceofCloudSketchbookTreeModel){
115+
returnmodel;
116+
}
117+
}
118+
}
119+
returnundefined;
120+
}
121+
}

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

Lines changed: 2 additions & 2 deletions
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,
@@ -147,7 +147,7 @@ export abstract class SketchContribution extends Contribution {
147147
protectedreadonlyconfigService:ConfigServiceClient;
148148

149149
@inject(SketchesService)
150-
protectedreadonlysketchService:SketchesService;
150+
protectedreadonlysketchesService:SketchesService;
151151

152152
@inject(OpenerService)
153153
protectedreadonlyopenerService:OpenerService;

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

Lines changed: 3 additions & 3 deletions
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
constCOMPILE_FOR_DEBUG_KEY='arduino-compile-for-debug';
@@ -187,7 +187,7 @@ export class Debug extends SketchContribution {
187187
if(!CurrentSketch.isValid(sketch)){
188188
return;
189189
}
190-
constideTempFolderUri=awaitthis.sketchService.getIdeTempFolderUri(
190+
constideTempFolderUri=awaitthis.sketchesService.getIdeTempFolderUri(
191191
sketch
192192
);
193193
const[cliPath,sketchPath,configPath]=awaitPromise.all([
@@ -246,7 +246,7 @@ export class Debug extends SketchContribution {
246246
):Promise<boolean>{
247247
if(errinstanceofError){
248248
try{
249-
consttempBuildPaths=awaitthis.sketchService.tempBuildPath(sketch);
249+
consttempBuildPaths=awaitthis.sketchesService.tempBuildPath(sketch);
250250
returntempBuildPaths.some((tempBuildPath)=>
251251
err.message.includes(tempBuildPath)
252252
);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp