Skip to content

Commit 6b84951

Browse files
committed
fix: expose stdio transport fallback (#300)
1 parent 97f42ab commit 6b84951

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

‎Readme.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ The following coc.nvim settings are supported (checkout `:h coc-configuration` f
131131
- `java.jdt.ls.statusIcons`: Specifies the status icon for the Java Language Server. The status icon is displayed in the status bar when the Java Language Server is running. default to {"busy": "Busy", "ready": "OK", "warning": "Warning", "Error", "Error"} Default: `null`
132132
- `java.jdt.ls.java.home`: Specifies the folder path to the JDK (17 or more recent) used to launch the Java Language Server. This setting will replace the Java extension's embedded JRE to start the Java Language Server. On Windows, backslashes must be escaped, i.e. "java.jdt.ls.java.home":"C:\\Program Files\\Java\\jdk-17.0_3" Default: `null`
133133
- `java.jdt.ls.vmargs`: Specifies extra VM arguments used to launch the Java Language Server. Eg. use `-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -Xlog:disable` to optimize memory usage with the parallel garbage collector Default: `"-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -Xlog:disable"`
134+
- `java.transport`: Transport used to communicate with the Java Language Server. Use `"stdio"` when the default pipe transport cannot establish a connection. Default: `"pipe"`
135+
Valid options: ["pipe","stdio"]
134136
- `java.errors.incompleteClasspath.severity`: Specifies the severity of the message when the classpath is incomplete for a Java file Default: `"warning"`
135137
Valid options: ["ignore","info","warning","error"]
136138
- `java.configuration.checkProjectSettingsExclusions`: Controls whether to exclude extension-generated project settings files (.project, .classpath, .factorypath, .settings/) from the file explorer. Default: `false`

‎package.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,16 @@
118118
"description": "Specifies extra VM arguments used to launch the Java Language Server. Eg. use `-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable` to optimize memory usage with the parallel garbage collector",
119119
"scope": "machine-overridable"
120120
},
121+
"java.transport": {
122+
"type": "string",
123+
"enum": [
124+
"pipe",
125+
"stdio"
126+
],
127+
"default": "pipe",
128+
"description": "Transport used to communicate with the Java Language Server. Use 'stdio' when the default pipe transport cannot establish a connection.",
129+
"scope": "machine-overridable"
130+
},
121131
"java.errors.incompleteClasspath.severity": {
122132
"type": [
123133
"string"

‎test/contracts.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,16 @@ describe('coc-java fast contracts', () => {
164164
it('loads every contributed Java setting and forwards it during initialization', () => {
165165
const properties = packageJson.contributes.configuration.properties as Record<string, ConfigurationSchema>
166166
const entries = Object.entries(properties)
167-
assert.equal(entries.length, 133, 'update this contract when settings are intentionally added or removed')
167+
assert.equal(entries.length, 134, 'update this contract when settings are intentionally added or removed')
168+
169+
const transport = properties['java.transport']
170+
assert.equal(transport?.default, 'pipe')
171+
assert.deepEqual(transport?.enum, ['pipe', 'stdio'])
168172

169173
const javaSettings = virtualServer.getState().initializeParams?.initializationOptions?.settings?.java
170174
assert.ok(javaSettings, 'the virtual server should capture Java initialization settings')
171175
assert.equal(javaSettings.jdt.ls.kotlinSupport.enabled, true)
176+
assert.equal(javaSettings.transport, 'stdio', 'the configured client transport should be forwarded')
172177
assert.equal(javaSettings.inlayHints.formatParameters.enabled, false)
173178
assert.equal(javaSettings.search.scope, 'all')
174179
assert.equal(

0 commit comments

Comments
 (0)