@@ -8,17 +8,14 @@ import { WebSocketConnectionProvider } from '@theia/core/lib/browser/messaging/w
8
8
import { FrontendApplicationContribution , FrontendApplication as TheiaFrontendApplication } from '@theia/core/lib/browser/frontend-application'
9
9
import { LibraryListWidget } from './library/library-list-widget' ;
10
10
import { ArduinoFrontendContribution } from './arduino-frontend-contribution' ;
11
- import { LibraryServiceServer , LibraryServiceServerPath } from '../common/protocol/library-service' ;
12
- import { BoardsService , BoardsServicePath , BoardsServiceClient } from '../common/protocol/boards-service' ;
11
+ import { LibraryService , LibraryServicePath } from '../common/protocol/library-service' ;
12
+ import { BoardsService , BoardsServicePath } from '../common/protocol/boards-service' ;
13
13
import { SketchesService , SketchesServicePath } from '../common/protocol/sketches-service' ;
14
14
import { SketchesServiceClientImpl } from '../common/protocol/sketches-service-client-impl' ;
15
- import { CoreService , CoreServicePath , CoreServiceClient } from '../common/protocol/core-service' ;
15
+ import { CoreService , CoreServicePath } from '../common/protocol/core-service' ;
16
16
import { BoardsListWidget } from './boards/boards-list-widget' ;
17
17
import { BoardsListWidgetFrontendContribution } from './boards/boards-widget-frontend-contribution' ;
18
- import { ToolOutputServiceClient } from '../common/protocol/tool-output-service' ;
19
- import { ToolOutputService } from '../common/protocol/tool-output-service' ;
20
- import { ToolOutputServiceClientImpl } from './tool-output/client-service-impl' ;
21
- import { BoardsServiceClientImpl } from './boards/boards-service-client-impl' ;
18
+ import { BoardsServiceProvider } from './boards/boards-service-provider' ;
22
19
import { WorkspaceService as TheiaWorkspaceService } from '@theia/workspace/lib/browser/workspace-service' ;
23
20
import { WorkspaceService } from './theia/workspace/workspace-service' ;
24
21
import { OutlineViewContribution as TheiaOutlineViewContribution } from '@theia/outline-view/lib/browser/outline-view-contribution' ;
@@ -50,7 +47,7 @@ import { SearchInWorkspaceFrontendContribution } from './theia/search-in-workspa
50
47
import { LibraryListWidgetFrontendContribution } from './library/library-widget-frontend-contribution' ;
51
48
import { MonitorServiceClientImpl } from './monitor/monitor-service-client-impl' ;
52
49
import { MonitorServicePath , MonitorService , MonitorServiceClient } from '../common/protocol/monitor-service' ;
53
- import { ConfigService , ConfigServicePath , ConfigServiceClient } from '../common/protocol/config-service' ;
50
+ import { ConfigService , ConfigServicePath } from '../common/protocol/config-service' ;
54
51
import { MonitorWidget } from './monitor/monitor-widget' ;
55
52
import { MonitorViewContribution } from './monitor/monitor-view-contribution' ;
56
53
import { MonitorConnection } from './monitor/monitor-connection' ;
@@ -67,17 +64,14 @@ import { EditorMode } from './editor-mode';
67
64
import { ListItemRenderer } from './widgets/component-list/list-item-renderer' ;
68
65
import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution' ;
69
66
import { MonacoThemingService } from '@theia/monaco/lib/browser/monaco-theming-service' ;
70
- import { ArduinoDaemonClientImpl } from './arduino-daemon-client-impl' ;
71
- import { ArduinoDaemonClient , ArduinoDaemonPath , ArduinoDaemon } from '../common/protocol/arduino-daemon' ;
67
+ import { ArduinoDaemonPath , ArduinoDaemon } from '../common/protocol/arduino-daemon' ;
72
68
import { EditorManager as TheiaEditorManager } from '@theia/editor/lib/browser' ;
73
69
import { EditorManager } from './theia/editor/editor-manager' ;
74
70
import { FrontendConnectionStatusService , ApplicationConnectionStatusContribution } from './theia/core/connection-status-service' ;
75
71
import {
76
72
FrontendConnectionStatusService as TheiaFrontendConnectionStatusService ,
77
73
ApplicationConnectionStatusContribution as TheiaApplicationConnectionStatusContribution
78
74
} from '@theia/core/lib/browser/connection-status-service' ;
79
- import { ConfigServiceClientImpl } from './config-service-client-impl' ;
80
- import { CoreServiceClientImpl } from './core-service-client-impl' ;
81
75
import { BoardsDataMenuUpdater } from './boards/boards-data-menu-updater' ;
82
76
import { BoardsDataStore } from './boards/boards-data-store' ;
83
77
import { ILogger } from '@theia/core' ;
@@ -116,14 +110,17 @@ import { OutputWidget } from './theia/output/output-widget';
116
110
import { BurnBootloader } from './contributions/burn-bootloader' ;
117
111
import { ExamplesServicePath , ExamplesService } from '../common/protocol/examples-service' ;
118
112
import { BuiltInExamples , LibraryExamples } from './contributions/examples' ;
119
- import { LibraryServiceProvider } from './library/library-service-provider' ;
120
113
import { IncludeLibrary } from './contributions/include-library' ;
121
114
import { OutputChannelManager as TheiaOutputChannelManager } from '@theia/output/lib/common/output-channel' ;
122
115
import { OutputChannelManager } from './theia/output/output-channel' ;
123
116
import { OutputChannelRegistryMainImpl as TheiaOutputChannelRegistryMainImpl , OutputChannelRegistryMainImpl } from './theia/plugin-ext/output-channel-registry-main' ;
124
117
import { ExecutableService , ExecutableServicePath } from '../common/protocol' ;
125
118
import { MonacoTextModelService as TheiaMonacoTextModelService } from '@theia/monaco/lib/browser/monaco-text-model-service' ;
126
119
import { MonacoTextModelService } from './theia/monaco/monaco-text-model-service' ;
120
+ import { OutputServiceImpl } from './output-service-impl' ;
121
+ import { OutputServicePath , OutputService } from '../common/protocol/output-service' ;
122
+ import { NotificationCenter } from './notification-center' ;
123
+ import { NotificationServicePath , NotificationServiceServer } from '../common/protocol' ;
127
124
128
125
const ElementQueries = require ( 'css-element-queries/src/ElementQueries' ) ;
129
126
@@ -153,8 +150,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
153
150
bind ( ListItemRenderer ) . toSelf ( ) . inSingletonScope ( ) ;
154
151
155
152
// Library service
156
- bind ( LibraryServiceProvider ) . toSelf ( ) . inSingletonScope ( ) ;
157
- bind ( LibraryServiceServer ) . toDynamicValue ( context => WebSocketConnectionProvider . createProxy ( context . container , LibraryServiceServerPath ) ) . inSingletonScope ( ) ;
153
+ bind ( LibraryService ) . toDynamicValue ( context => WebSocketConnectionProvider . createProxy ( context . container , LibraryServicePath ) ) . inSingletonScope ( ) ;
158
154
159
155
// Library list widget
160
156
bind ( LibraryListWidget ) . toSelf ( ) ;
@@ -170,34 +166,13 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
170
166
bind ( SketchesServiceClientImpl ) . toSelf ( ) . inSingletonScope ( ) ;
171
167
172
168
// Config service
173
- bind ( ConfigService ) . toDynamicValue ( context => {
174
- const connection = context . container . get ( WebSocketConnectionProvider ) ;
175
- const client = context . container . get ( ConfigServiceClientImpl ) ;
176
- return connection . createProxy ( ConfigServicePath , client ) ;
177
- } ) . inSingletonScope ( ) ;
178
- bind ( ConfigServiceClientImpl ) . toSelf ( ) . inSingletonScope ( ) ;
179
- bind ( ConfigServiceClient ) . toDynamicValue ( context => {
180
- const client = context . container . get ( ConfigServiceClientImpl ) ;
181
- WebSocketConnectionProvider . createProxy ( context . container , ConfigServicePath , client ) ;
182
- return client ;
183
- } ) . inSingletonScope ( ) ;
169
+ bind ( ConfigService ) . toDynamicValue ( context => WebSocketConnectionProvider . createProxy ( context . container , ConfigServicePath ) ) . inSingletonScope ( ) ;
184
170
185
171
// Boards service
186
- bind ( BoardsService ) . toDynamicValue ( context => {
187
- const connection = context . container . get ( WebSocketConnectionProvider ) ;
188
- const client = context . container . get ( BoardsServiceClientImpl ) ;
189
- return connection . createProxy ( BoardsServicePath , client ) ;
190
- } ) . inSingletonScope ( ) ;
172
+ bind ( BoardsService ) . toDynamicValue ( context => WebSocketConnectionProvider . createProxy ( context . container , BoardsServicePath ) ) . inSingletonScope ( ) ;
191
173
// Boards service client to receive and delegate notifications from the backend.
192
- bind ( BoardsServiceClientImpl ) . toSelf ( ) . inSingletonScope ( ) ;
193
- bind ( FrontendApplicationContribution ) . toService ( BoardsServiceClientImpl ) ;
194
- bind ( BoardsServiceClient ) . toDynamicValue ( async context => {
195
- const client = context . container . get ( BoardsServiceClientImpl ) ;
196
- const service = context . container . get < BoardsService > ( BoardsService ) ;
197
- await client . init ( service ) ;
198
- WebSocketConnectionProvider . createProxy ( context . container , BoardsServicePath , client ) ;
199
- return client ;
200
- } ) . inSingletonScope ( ) ;
174
+ bind ( BoardsServiceProvider ) . toSelf ( ) . inSingletonScope ( ) ;
175
+ bind ( FrontendApplicationContribution ) . toService ( BoardsServiceProvider ) ;
201
176
202
177
// To be able to track, and update the menu based on the core settings (aka. board details) of the currently selected board.
203
178
bind ( FrontendApplicationContribution ) . to ( BoardsDataMenuUpdater ) . inSingletonScope ( ) ;
@@ -230,26 +205,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
230
205
} )
231
206
232
207
// Core service
233
- bind ( CoreService ) . toDynamicValue ( context => {
234
- const connection = context . container . get ( WebSocketConnectionProvider ) ;
235
- const client = context . container . get ( CoreServiceClientImpl ) ;
236
- return connection . createProxy ( CoreServicePath , client ) ;
237
- } ) . inSingletonScope ( ) ;
238
- // Core service client to receive and delegate notifications when the index or the library index has been updated.
239
- bind ( CoreServiceClientImpl ) . toSelf ( ) . inSingletonScope ( ) ;
240
- bind ( CoreServiceClient ) . toDynamicValue ( context => {
241
- const client = context . container . get ( CoreServiceClientImpl ) ;
242
- WebSocketConnectionProvider . createProxy ( context . container , CoreServicePath , client ) ;
243
- return client ;
244
- } ) . inSingletonScope ( ) ;
245
-
246
- // Tool output service client
247
- bind ( ToolOutputServiceClientImpl ) . toSelf ( ) . inSingletonScope ( ) ;
248
- bind ( ToolOutputServiceClient ) . toDynamicValue ( context => {
249
- const client = context . container . get ( ToolOutputServiceClientImpl ) ;
250
- WebSocketConnectionProvider . createProxy ( context . container , ToolOutputService . SERVICE_PATH , client ) ;
251
- return client ;
252
- } ) . inSingletonScope ( ) ;
208
+ bind ( CoreService ) . toDynamicValue ( context => WebSocketConnectionProvider . createProxy ( context . container , CoreServicePath ) ) . inSingletonScope ( ) ;
253
209
254
210
// Serial monitor
255
211
bind ( MonitorModel ) . toSelf ( ) . inSingletonScope ( ) ;
@@ -341,18 +297,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
341
297
bind ( ShellLayoutRestorer ) . toSelf ( ) . inSingletonScope ( ) ;
342
298
rebind ( TheiaShellLayoutRestorer ) . toService ( ShellLayoutRestorer ) ;
343
299
344
- // Arduino daemon client. Receives notifications from the backend if the CLI daemon process has been restarted.
345
- bind ( ArduinoDaemon ) . toDynamicValue ( context => {
346
- const connection = context . container . get ( WebSocketConnectionProvider ) ;
347
- const client = context . container . get ( ArduinoDaemonClientImpl ) ;
348
- return connection . createProxy ( ArduinoDaemonPath , client ) ;
349
- } ) . inSingletonScope ( ) ;
350
- bind ( ArduinoDaemonClientImpl ) . toSelf ( ) . inSingletonScope ( ) ;
351
- bind ( ArduinoDaemonClient ) . toDynamicValue ( context => {
352
- const client = context . container . get ( ArduinoDaemonClientImpl ) ;
353
- WebSocketConnectionProvider . createProxy ( context . container , ArduinoDaemonPath , client ) ;
354
- return client ;
355
- } ) . inSingletonScope ( ) ;
300
+ bind ( ArduinoDaemon ) . toDynamicValue ( context => WebSocketConnectionProvider . createProxy ( context . container , ArduinoDaemonPath ) ) . inSingletonScope ( ) ;
356
301
357
302
// File-system extension
358
303
bind ( FileSystemExt ) . toDynamicValue ( context => WebSocketConnectionProvider . createProxy ( context . container , FileSystemExtPath ) ) . inSingletonScope ( ) ;
@@ -379,4 +324,13 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
379
324
Contribution . configure ( bind , BuiltInExamples ) ;
380
325
Contribution . configure ( bind , LibraryExamples ) ;
381
326
Contribution . configure ( bind , IncludeLibrary ) ;
327
+
328
+ bind ( OutputServiceImpl ) . toSelf ( ) . inSingletonScope ( ) . onActivation ( ( { container } , outputService ) => {
329
+ WebSocketConnectionProvider . createProxy ( container , OutputServicePath , outputService ) ;
330
+ return outputService ;
331
+ } ) ;
332
+ bind ( OutputService ) . toService ( OutputServiceImpl ) ;
333
+
334
+ bind ( NotificationCenter ) . toSelf ( ) . inSingletonScope ( ) ;
335
+ bind ( NotificationServiceServer ) . toDynamicValue ( context => WebSocketConnectionProvider . createProxy ( context . container , NotificationServicePath ) ) . inSingletonScope ( ) ;
382
336
} ) ;
0 commit comments