Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 5cbbe39

Browse files
author
Winston Liu
authored
Add support for updating build configuration
1 parent 437d5e1 commit 5cbbe39

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

lib/main.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,22 @@ class JavaLanguageClient extends AutoLanguageClient {
3636
atom.config.set('ide-java.server.errors.incompleteClasspath.severity', 'ignore')
3737
},
3838
'java.ignoreIncompleteClasspath.help': () => { shell.openExternal('https://github.com/atom/ide-java/wiki/Incomplete-Classpath-Warning') },
39+
'java.projectConfiguration.status': (command, connection) => {
40+
// Arguments:
41+
// - 0: Object containing build file URI
42+
// - 1: 'disabled' for Never, 'interactive' for Now, 'automatic' for Always
43+
const [uri, status] = command.arguments
44+
const statusMap = {
45+
0: 'disabled',
46+
1: 'interactive',
47+
2: 'automatic',
48+
}
49+
atom.config.set('ide-java.server.configuration.updateBuildConfiguration', statusMap[status])
50+
51+
if (status !== 0) {
52+
connection.sendCustomRequest('java/projectConfigurationUpdate', uri)
53+
}
54+
}
3955
}
4056

4157
// Migrate ide-java.errors.incompleteClasspathSeverity -> ide-java.server.errors.incompleteClasspath.severity
@@ -210,7 +226,16 @@ class JavaLanguageClient extends AutoLanguageClient {
210226
}
211227

212228
preInitialization(connection) {
213-
connection.onCustom('language/status', (e) => this.updateStatusBar(`${e.type.replace(/^Started$/, '')} ${e.message}`))
229+
let started = false
230+
connection.onCustom('language/status', (status) => {
231+
if (started) return
232+
this.updateStatusBar(status.message)
233+
// Additional messages can be generated after the server is ready
234+
// that we don't want to show (for example, build refreshes)
235+
if (status.type === 'Started') {
236+
started = true
237+
}
238+
})
214239
connection.onCustom('language/actionableNotification', (notification) => this.actionableNotification(notification, connection))
215240
}
216241

0 commit comments

Comments
 (0)