@@ -21,15 +21,30 @@ class JavaLanguageClient extends AutoLanguageClient {
2121 getGrammarScopes ( ) { return [ 'source.java' ] }
2222 getLanguageName ( ) { return 'Java' }
2323 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 } }
2428
2529 constructor ( ) {
2630 super ( )
2731 this . statusElement = document . createElement ( 'span' )
2832 this . statusElement . className = 'inline-block'
2933
3034 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 )
3348 }
3449 }
3550
@@ -196,7 +211,7 @@ class JavaLanguageClient extends AutoLanguageClient {
196211
197212 preInitialization ( connection ) {
198213 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 ) )
200215 }
201216
202217 getInitializeParams ( projectPath , process ) {
@@ -205,11 +220,6 @@ class JavaLanguageClient extends AutoLanguageClient {
205220 params . initializationOptions = { } ;
206221 }
207222 params . initializationOptions . bundles = this . collectJavaExtensions ( ) ;
208- params . initializationOptions . settings = {
209- java : {
210- "java.signatureHelp.enabled" : true
211- }
212- }
213223 return params ;
214224 }
215225
@@ -246,39 +256,23 @@ class JavaLanguageClient extends AutoLanguageClient {
246256 }
247257 }
248258
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 ) {
268260 const options = { dismissable : true , detail : this . getServerName ( ) }
269261 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+ } ) )
272266 }
273267
274268 const notificationDialog = this . createNotification ( notification . severity , notification . message , options )
275269
276- const onActionableButton = ( event , commandName ) => {
277- const commandFunction = this . commands [ commandName ]
270+ const onActionableButton = ( command ) => {
271+ const commandFunction = this . commands [ command . command ]
278272 if ( commandFunction != null ) {
279- commandFunction ( )
273+ commandFunction ( command , connection )
280274 } else {
281- console . log ( `Unknown actionableNotification command '${ commandName } '` )
275+ console . log ( `Unknown actionableNotification command '${ command . command } '` )
282276 }
283277 notificationDialog . dismiss ( )
284278 }
0 commit comments