@@ -12,7 +12,6 @@ import { ConnectedBoards } from './components/connected-boards';
12
12
import { CoreService } from '../common/protocol/core-service' ;
13
13
import { WorkspaceServiceExt } from './workspace-service-ext' ;
14
14
import { ToolOutputServiceClient } from '../common/protocol/tool-output-service' ;
15
- import { ConfirmDialog } from '@theia/core/lib/browser' ;
16
15
import { QuickPickService } from '@theia/core/lib/common/quick-pick-service' ;
17
16
import { BoardsListWidgetFrontendContribution } from './boards/boards-widget-frontend-contribution' ;
18
17
import { BoardsNotificationService } from './boards-notification-service' ;
@@ -101,9 +100,14 @@ export class ArduinoFrontendContribution extends DefaultFrontendApplicationContr
101
100
}
102
101
103
102
const uri = this . toUri ( widget ) ;
104
- if ( uri ) {
105
- const result = await this . coreService . compile ( { uri : uri . toString ( ) } ) ;
106
- console . log ( 'compile result' , result ) ;
103
+ if ( ! uri ) {
104
+ return ;
105
+ }
106
+
107
+ try {
108
+ await this . coreService . compile ( { uri : uri . toString ( ) } ) ;
109
+ } catch ( e ) {
110
+ await this . messageService . error ( e . toString ( ) ) ;
107
111
}
108
112
}
109
113
} ) ;
@@ -123,19 +127,28 @@ export class ArduinoFrontendContribution extends DefaultFrontendApplicationContr
123
127
try {
124
128
await this . coreService . upload ( { uri : uri . toString ( ) } ) ;
125
129
} catch ( e ) {
126
- new ConfirmDialog ( { title : "Error during upload" , msg : e . toString ( ) , ok : "Ok" } ) . open ( ) ;
130
+ await this . messageService . error ( e . toString ( ) ) ;
127
131
}
128
132
}
129
133
} ) ;
130
134
registry . registerCommand ( ArduinoCommands . NEW_SKETCH , new WorkspaceRootUriAwareCommandHandler ( this . workspaceService , this . selectionService , {
131
135
execute : async uri => {
132
136
try {
137
+ // hack: sometimes we don't get the workspace root, but the currently active file: correct for that
138
+ if ( uri . path . ext !== "" ) {
139
+ uri = uri . withPath ( uri . path . dir . dir ) ;
140
+ }
141
+
133
142
await this . sketchFactory . createNewSketch ( uri ) ;
134
143
} catch ( e ) {
135
- new ConfirmDialog ( { title : "Cannot create new sketch" , msg : e . toString ( ) , ok : "Ok" } ) . open ( ) ;
144
+ await this . messageService . error ( e . toString ( ) ) ;
136
145
}
137
146
}
138
- } ) )
147
+ } ) ) ;
148
+ registry . registerCommand ( ArduinoCommands . REFRESH_BOARDS , {
149
+ isEnabled : ( ) => true ,
150
+ execute : ( ) => this . boardsNotificationService . notifyBoardsInstalled ( )
151
+ } )
139
152
}
140
153
141
154
private async onNoBoardsInstalled ( ) {
0 commit comments