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

Commit 0b0dd6d

Browse files
author
Winston Liu
authored
Merge pull request #111 from atom/wl-build-config
Add support for updating build configuration
2 parents 437d5e1 + 9cd50e6 commit 0b0dd6d

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-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

package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,30 @@
3535
"title": "Language Server",
3636
"description": "Settings that control language server functionality.",
3737
"properties": {
38+
"configuration": {
39+
"type": "object",
40+
"title": "Project Configuration",
41+
"properties": {
42+
"updateBuildConfiguration": {
43+
"type": "string",
44+
"title": "Update Build Configuration",
45+
"enum": [
46+
{"value": "disabled", "description": "Never"},
47+
{"value": "interactive", "description": "Ask every time"},
48+
{"value": "automatic", "description": "Always"}
49+
],
50+
"default": "interactive",
51+
"description": "Whether to automatically update the project configuration when build files change."
52+
}
53+
}
54+
},
3855
"signatureHelp": {
3956
"type": "object",
4057
"title": "Signature Help",
4158
"properties": {
4259
"enabled": {
4360
"type": "boolean",
61+
"title": "Enabled",
4462
"default": true,
4563
"description": "Controls whether signature help is enabled."
4664
}

0 commit comments

Comments
 (0)