1
- import { inject , injectable , postConstruct } from '@theia/core/shared/inversify' ;
1
+ import {
2
+ inject ,
3
+ injectable ,
4
+ postConstruct ,
5
+ } from '@theia/core/shared/inversify' ;
2
6
import * as React from '@theia/core/shared/react' ;
3
7
import * as remote from '@theia/core/electron-shared/@electron/remote' ;
4
8
import {
@@ -45,19 +49,13 @@ import {
45
49
EditorManager ,
46
50
EditorOpenerOptions ,
47
51
} from '@theia/editor/lib/browser' ;
48
- import { ProblemContribution } from '@theia/markers/lib/browser/problem/problem-contribution' ;
49
52
import { MonacoMenus } from '@theia/monaco/lib/browser/monaco-menu' ;
50
- import { FileNavigatorCommands , FileNavigatorContribution } from '@theia/navigator/lib/browser/navigator-contribution' ;
51
- import { OutlineViewContribution } from '@theia/outline-view/lib/browser/outline-view-contribution' ;
52
- import { OutputContribution } from '@theia/output/lib/browser/output-contribution' ;
53
- import { ScmContribution } from '@theia/scm/lib/browser/scm-contribution' ;
54
- import { SearchInWorkspaceFrontendContribution } from '@theia/search-in-workspace/lib/browser/search-in-workspace-frontend-contribution' ;
53
+ import { FileNavigatorCommands } from '@theia/navigator/lib/browser/navigator-contribution' ;
55
54
import { TerminalMenus } from '@theia/terminal/lib/browser/terminal-frontend-contribution' ;
56
55
import { HostedPluginSupport } from '@theia/plugin-ext/lib/hosted/browser/hosted-plugin' ;
57
56
import { FileService } from '@theia/filesystem/lib/browser/file-service' ;
58
57
import { FileChangeType } from '@theia/filesystem/lib/browser' ;
59
58
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state' ;
60
- import { ConfigService } from '../common/protocol/config-service' ;
61
59
import { ArduinoCommands } from './arduino-commands' ;
62
60
import { BoardsConfig } from './boards/boards-config' ;
63
61
import { BoardsConfigDialog } from './boards/boards-config-dialog' ;
@@ -70,7 +68,6 @@ import { ArduinoToolbar } from './toolbar/arduino-toolbar';
70
68
import { ArduinoPreferences } from './arduino-preferences' ;
71
69
import { SketchesServiceClientImpl } from '../common/protocol/sketches-service-client-impl' ;
72
70
import { SaveAsSketch } from './contributions/save-as-sketch' ;
73
- import { SketchbookWidgetContribution } from './widgets/sketchbook/sketchbook-widget-contribution' ;
74
71
import { IDEUpdaterDialog } from './dialogs/ide-updater/ide-updater-dialog' ;
75
72
import { IDEUpdater } from '../common/protocol/ide-updater' ;
76
73
import { FileSystemFrontendContribution } from '@theia/filesystem/lib/browser/filesystem-frontend-contribution' ;
@@ -85,96 +82,73 @@ export class ArduinoFrontendContribution
85
82
TabBarToolbarContribution ,
86
83
CommandContribution ,
87
84
MenuContribution ,
88
- ColorContribution {
85
+ ColorContribution
86
+ {
89
87
@inject ( ILogger )
90
- protected logger : ILogger ;
88
+ private readonly logger : ILogger ;
91
89
92
90
@inject ( MessageService )
93
- protected readonly messageService : MessageService ;
91
+ private readonly messageService : MessageService ;
94
92
95
93
@inject ( BoardsService )
96
- protected readonly boardsService : BoardsService ;
94
+ private readonly boardsService : BoardsService ;
97
95
98
96
@inject ( LibraryService )
99
- protected readonly libraryService : LibraryService ;
97
+ private readonly libraryService : LibraryService ;
100
98
101
99
@inject ( BoardsServiceProvider )
102
- protected readonly boardsServiceClientImpl : BoardsServiceProvider ;
100
+ private readonly boardsServiceClientImpl : BoardsServiceProvider ;
103
101
104
102
@inject ( EditorManager )
105
- protected readonly editorManager : EditorManager ;
103
+ private readonly editorManager : EditorManager ;
106
104
107
105
@inject ( FileService )
108
- protected readonly fileService : FileService ;
106
+ private readonly fileService : FileService ;
109
107
110
108
@inject ( SketchesService )
111
- protected readonly sketchService : SketchesService ;
109
+ private readonly sketchService : SketchesService ;
112
110
113
111
@inject ( BoardsConfigDialog )
114
- protected readonly boardsConfigDialog : BoardsConfigDialog ;
112
+ private readonly boardsConfigDialog : BoardsConfigDialog ;
115
113
116
114
@inject ( CommandRegistry )
117
- protected readonly commandRegistry : CommandRegistry ;
115
+ private readonly commandRegistry : CommandRegistry ;
118
116
119
117
@inject ( StatusBar )
120
- protected readonly statusBar : StatusBar ;
121
-
122
- @inject ( FileNavigatorContribution )
123
- protected readonly fileNavigatorContributions : FileNavigatorContribution ;
124
-
125
- @inject ( OutputContribution )
126
- protected readonly outputContribution : OutputContribution ;
127
-
128
- @inject ( OutlineViewContribution )
129
- protected readonly outlineContribution : OutlineViewContribution ;
130
-
131
- @inject ( ProblemContribution )
132
- protected readonly problemContribution : ProblemContribution ;
133
-
134
- @inject ( ScmContribution )
135
- protected readonly scmContribution : ScmContribution ;
136
-
137
- @inject ( SearchInWorkspaceFrontendContribution )
138
- protected readonly siwContribution : SearchInWorkspaceFrontendContribution ;
139
-
140
- @inject ( SketchbookWidgetContribution )
141
- protected readonly sketchbookWidgetContribution : SketchbookWidgetContribution ;
118
+ private readonly statusBar : StatusBar ;
142
119
143
120
@inject ( EditorMode )
144
- protected readonly editorMode : EditorMode ;
145
-
146
- @inject ( ConfigService )
147
- protected readonly configService : ConfigService ;
121
+ private readonly editorMode : EditorMode ;
148
122
149
123
@inject ( HostedPluginSupport )
150
- protected hostedPluginSupport : HostedPluginSupport ;
124
+ private readonly hostedPluginSupport : HostedPluginSupport ;
151
125
152
126
@inject ( ExecutableService )
153
- protected executableService : ExecutableService ;
127
+ private readonly executableService : ExecutableService ;
154
128
155
129
@inject ( ArduinoPreferences )
156
- protected readonly arduinoPreferences : ArduinoPreferences ;
130
+ private readonly arduinoPreferences : ArduinoPreferences ;
157
131
158
132
@inject ( SketchesServiceClientImpl )
159
- protected readonly sketchServiceClient : SketchesServiceClientImpl ;
133
+ private readonly sketchServiceClient : SketchesServiceClientImpl ;
160
134
161
135
@inject ( FrontendApplicationStateService )
162
- protected readonly appStateService : FrontendApplicationStateService ;
136
+ private readonly appStateService : FrontendApplicationStateService ;
163
137
164
138
@inject ( LocalStorageService )
165
- protected readonly localStorageService : LocalStorageService ;
139
+ private readonly localStorageService : LocalStorageService ;
166
140
167
141
@inject ( FileSystemFrontendContribution )
168
- protected readonly fileSystemFrontendContribution : FileSystemFrontendContribution ;
142
+ private readonly fileSystemFrontendContribution : FileSystemFrontendContribution ;
169
143
170
144
@inject ( IDEUpdater )
171
- protected readonly updater : IDEUpdater ;
145
+ private readonly updater : IDEUpdater ;
172
146
173
147
@inject ( IDEUpdaterDialog )
174
- protected readonly updaterDialog : IDEUpdaterDialog ;
148
+ private readonly updaterDialog : IDEUpdaterDialog ;
175
149
176
150
@inject ( ArduinoDaemon )
177
- protected readonly daemon : ArduinoDaemon ;
151
+ private readonly daemon : ArduinoDaemon ;
178
152
179
153
protected invalidConfigPopup :
180
154
| Promise < void | 'No' | 'Yes' | undefined >
@@ -271,21 +245,6 @@ export class ArduinoFrontendContribution
271
245
}
272
246
273
247
async onStart ( app : FrontendApplication ) : Promise < void > {
274
- // Initialize all `pro-mode` widgets. This is a NOOP if in normal mode.
275
- for ( const viewContribution of [
276
- this . fileNavigatorContributions ,
277
- this . outputContribution ,
278
- this . outlineContribution ,
279
- this . problemContribution ,
280
- this . scmContribution ,
281
- this . siwContribution ,
282
- this . sketchbookWidgetContribution ,
283
- ] as Array < FrontendApplicationContribution > ) {
284
- if ( viewContribution . initializeLayout ) {
285
- viewContribution . initializeLayout ( app ) ;
286
- }
287
- }
288
-
289
248
this . updater
290
249
. init (
291
250
this . arduinoPreferences . get ( 'arduino.ide.updateChannel' ) ,
@@ -349,16 +308,18 @@ export class ArduinoFrontendContribution
349
308
350
309
app . shell . leftPanelHandler . removeBottomMenu ( 'settings-menu' ) ;
351
310
352
- this . fileSystemFrontendContribution . onDidChangeEditorFile ( e => {
353
- if ( e . type === FileChangeType . DELETED ) {
354
- const editorWidget = e . editor ;
355
- if ( SaveableWidget . is ( editorWidget ) ) {
356
- editorWidget . closeWithoutSaving ( ) ;
357
- } else {
358
- editorWidget . close ( ) ;
311
+ this . fileSystemFrontendContribution . onDidChangeEditorFile (
312
+ ( { type, editor } ) => {
313
+ if ( type === FileChangeType . DELETED ) {
314
+ const editorWidget = editor ;
315
+ if ( SaveableWidget . is ( editorWidget ) ) {
316
+ editorWidget . closeWithoutSaving ( ) ;
317
+ } else {
318
+ editorWidget . close ( ) ;
319
+ }
359
320
}
360
321
}
361
- } ) ;
322
+ ) ;
362
323
}
363
324
364
325
onStop ( ) : void {
@@ -501,13 +462,13 @@ export class ArduinoFrontendContribution
501
462
EditorCommands . SPLIT_EDITOR_UP ,
502
463
EditorCommands . SPLIT_EDITOR_VERTICAL ,
503
464
EditorCommands . SPLIT_EDITOR_HORIZONTAL ,
504
- FileNavigatorCommands . REVEAL_IN_NAVIGATOR
465
+ FileNavigatorCommands . REVEAL_IN_NAVIGATOR ,
505
466
] ) {
506
467
registry . unregisterCommand ( command ) ;
507
468
}
508
469
}
509
470
510
- registerMenus ( registry : MenuModelRegistry ) {
471
+ registerMenus ( registry : MenuModelRegistry ) : void {
511
472
const menuId = ( menuPath : string [ ] ) : string => {
512
473
const index = menuPath . length - 1 ;
513
474
const menuId = menuPath [ index ] ;
@@ -576,7 +537,7 @@ export class ArduinoFrontendContribution
576
537
uri : string ,
577
538
forceOpen = false ,
578
539
options ?: EditorOpenerOptions | undefined
579
- ) : Promise < any > {
540
+ ) : Promise < unknown > {
580
541
const widget = this . editorManager . all . find (
581
542
( widget ) => widget . editor . uri . toString ( ) === uri
582
543
) ;
0 commit comments