@@ -21,15 +21,30 @@ class JavaLanguageClient extends AutoLanguageClient {
21
21
getGrammarScopes ( ) { return [ 'source.java' ] }
22
22
getLanguageName ( ) { return 'Java' }
23
23
getServerName ( ) { return 'Eclipse JDT' }
24
+ // List of preferences available at:
25
+ // https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/preferences/Preferences.java
26
+ getRootConfigurationKey ( ) { return 'ide-java.server' }
27
+ mapConfigurationObject ( configuration ) { return { java : configuration } }
24
28
25
29
constructor ( ) {
26
30
super ( )
27
31
this . statusElement = document . createElement ( 'span' )
28
32
this . statusElement . className = 'inline-block'
29
33
30
34
this . commands = {
31
- 'java.ignoreIncompleteClasspath' : ( ) => { atom . config . set ( 'ide-java.errors.incompleteClasspathSeverity' , 'ignore' ) } ,
32
- 'java.ignoreIncompleteClasspath.help' : ( ) => { shell . openExternal ( 'https://github.com/atom/ide-java/wiki/Incomplete-Classpath-Warning' ) }
35
+ 'java.ignoreIncompleteClasspath' : ( ) => {
36
+ atom . config . set ( 'ide-java.server.errors.incompleteClasspath.severity' , 'ignore' )
37
+ } ,
38
+ 'java.ignoreIncompleteClasspath.help' : ( ) => { shell . openExternal ( 'https://github.com/atom/ide-java/wiki/Incomplete-Classpath-Warning' ) } ,
39
+ }
40
+
41
+ // Migrate ide-java.errors.incompleteClasspathSeverity -> ide-java.server.errors.incompleteClasspath.severity
42
+ // Migration added in v0.10.0; feel free to remove after a few versions
43
+ const severity = atom . config . get ( 'ide-java.errors.incompleteClasspathSeverity' )
44
+ if ( severity ) {
45
+ atom . config . unset ( 'ide-java.errors.incompleteClasspathSeverity' )
46
+ atom . config . unset ( 'ide-java.errors' )
47
+ atom . config . set ( 'ide-java.server.errors.incompleteClasspath.severity' , severity )
33
48
}
34
49
}
35
50
@@ -196,7 +211,7 @@ class JavaLanguageClient extends AutoLanguageClient {
196
211
197
212
preInitialization ( connection ) {
198
213
connection . onCustom ( 'language/status' , ( e ) => this . updateStatusBar ( `${ e . type . replace ( / ^ S t a r t e d $ / , '' ) } ${ e . message } ` ) )
199
- connection . onCustom ( 'language/actionableNotification' , this . actionableNotification . bind ( this ) )
214
+ connection . onCustom ( 'language/actionableNotification' , ( notification ) => this . actionableNotification ( notification , connection ) )
200
215
}
201
216
202
217
getInitializeParams ( projectPath , process ) {
@@ -205,11 +220,6 @@ class JavaLanguageClient extends AutoLanguageClient {
205
220
params . initializationOptions = { } ;
206
221
}
207
222
params . initializationOptions . bundles = this . collectJavaExtensions ( ) ;
208
- params . initializationOptions . settings = {
209
- java : {
210
- "java.signatureHelp.enabled" : true
211
- }
212
- }
213
223
return params ;
214
224
}
215
225
@@ -246,39 +256,23 @@ class JavaLanguageClient extends AutoLanguageClient {
246
256
}
247
257
}
248
258
249
- actionableNotification ( notification ) {
250
- if ( notification . message . startsWith ( 'Classpath is incomplete.' ) ) {
251
- switch ( atom . config . get ( 'ide-java.errors.incompleteClasspathSeverity' ) ) {
252
- case 'ignore' : return
253
- case 'error' : {
254
- notification . severity = 1
255
- break
256
- }
257
- case 'warning' : {
258
- notification . severity = 2
259
- break
260
- }
261
- case 'info' : {
262
- notification . severity = 3
263
- break
264
- }
265
- }
266
- }
267
-
259
+ actionableNotification ( notification , connection ) {
268
260
const options = { dismissable : true , detail : this . getServerName ( ) }
269
261
if ( Array . isArray ( notification . commands ) ) {
270
- options . buttons = notification . commands . map ( c => ( { text : c . title , onDidClick : ( e ) => onActionableButton ( e , c . command ) } ) )
271
- // TODO: Deal with the actions
262
+ options . buttons = notification . commands . map ( command => ( {
263
+ text : command . title ,
264
+ onDidClick : ( ) => onActionableButton ( command )
265
+ } ) )
272
266
}
273
267
274
268
const notificationDialog = this . createNotification ( notification . severity , notification . message , options )
275
269
276
- const onActionableButton = ( event , commandName ) => {
277
- const commandFunction = this . commands [ commandName ]
270
+ const onActionableButton = ( command ) => {
271
+ const commandFunction = this . commands [ command . command ]
278
272
if ( commandFunction != null ) {
279
- commandFunction ( )
273
+ commandFunction ( command , connection )
280
274
} else {
281
- console . log ( `Unknown actionableNotification command '${ commandName } '` )
275
+ console . log ( `Unknown actionableNotification command '${ command . command } '` )
282
276
}
283
277
notificationDialog . dismiss ( )
284
278
}
0 commit comments