Skip to content

Commit c7cfca4

Browse files
committed
Add support for TransportKind.pipe through java.transport setting.
- Do not expose java.transport setting to UI Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
1 parent ff5fcb3 commit c7cfca4

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/javaServerStarter.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as net from 'net';
55
import * as os from 'os';
66
import * as path from 'path';
77
import { ExtensionContext, version, workspace } from 'vscode';
8-
import { Executable, ExecutableOptions, StreamInfo } from 'vscode-languageclient/node';
8+
import { Executable, ExecutableOptions, StreamInfo, TransportKind } from 'vscode-languageclient/node';
99
import { logger } from './log';
1010
import { addLombokParam, isLombokSupportEnabled } from './lombokSupport';
1111
import { RequirementsData } from './requirements';
@@ -48,6 +48,21 @@ export function prepareExecutable(requirements: RequirementsData, workspacePath,
4848
executable.options = options;
4949
executable.command = path.resolve(`${requirements.tooling_jre}/bin/java`);
5050
executable.args = prepareParams(requirements, workspacePath, context, isSyntaxServer);
51+
const transportKind = getJavaConfiguration().get('transport');
52+
switch (transportKind) {
53+
case 'pipe':
54+
executable.transport = TransportKind.pipe;
55+
break;
56+
case 'stdio':
57+
executable.transport = TransportKind.stdio;
58+
break;
59+
default:
60+
const isInsider: boolean = version.includes("insider");
61+
const javaExtVersion = context.extension.packageJSON?.version;
62+
const isPreReleaseVersion = /^\d+\.\d+\.\d{10}/.test(javaExtVersion);
63+
executable.transport = (isInsider || isPreReleaseVersion) ? TransportKind.pipe : TransportKind.stdio;
64+
break;
65+
}
5166
logger.info(`Starting Java server with: ${executable.command} ${executable.args.join(' ')}`);
5267
return executable;
5368
}

src/settings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ function hasJavaConfigChanged(oldConfig: WorkspaceConfiguration, newConfig: Work
134134
|| hasConfigKeyChanged('home', oldConfig, newConfig)
135135
|| hasConfigKeyChanged('jdt.ls.vmargs', oldConfig, newConfig)
136136
|| hasConfigKeyChanged('server.launchMode', oldConfig, newConfig)
137-
|| hasConfigKeyChanged('sharedIndexes.location', oldConfig, newConfig);;
137+
|| hasConfigKeyChanged('sharedIndexes.location', oldConfig, newConfig)
138+
|| hasConfigKeyChanged('transport', oldConfig, newConfig);
138139
}
139140

140141
function hasConfigKeyChanged(key, oldConfig, newConfig) {

0 commit comments

Comments
 (0)