Skip to content

Commit a96e021

Browse files
committed
(GH-459) Refactor CommandHelper for DebugServer
Previously the command helper was only generating information for the language server. Now the the debug server consumes this information too the helper needs to be refactored to accomodate the new server. The refactor renames the getRubyEnvFromConfiguration method to getLanguageServerRubyEnvFromConfiguration
1 parent baa0cfb commit a96e021

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/handlers/stdio.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class StdioConnectionHandler extends ConnectionHandler {
2626
}
2727

2828
createServerOptions(): ServerOptions {
29-
let exe: Executable = CommandEnvironmentHelper.getRubyEnvFromConfiguration(
29+
let exe: Executable = CommandEnvironmentHelper.getLanguageServerRubyEnvFromConfiguration(
3030
this.context.asAbsolutePath(this.config.languageServerPath),
3131
this.settings,
3232
this.config,

src/handlers/tcp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class TcpConnectionHandler extends ConnectionHandler {
2222
this.logger.debug(`Configuring ${ConnectionType[this.connectionType]}::${this.protocolType} connection handler`);
2323

2424
if (this.connectionType === ConnectionType.Local) {
25-
let exe: Executable = CommandEnvironmentHelper.getRubyEnvFromConfiguration(
25+
let exe: Executable = CommandEnvironmentHelper.getLanguageServerRubyEnvFromConfiguration(
2626
this.context.asAbsolutePath(this.config.languageServerPath),
2727
this.settings,
2828
this.config,

src/helpers/commandHelper.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { PuppetInstallType, ProtocolType, IConnectionConfiguration } from '../in
77
import { PathResolver } from '../configuration/pathResolver';
88

99
export class CommandEnvironmentHelper {
10-
public static getRubyEnvFromConfiguration(
10+
public static getLanguageServerRubyEnvFromConfiguration(
1111
languageServerpath: string,
1212
settings: ISettings,
1313
config: IConnectionConfiguration,
@@ -17,6 +17,15 @@ export class CommandEnvironmentHelper {
1717
args: this.buildLanguageServerArguments(languageServerpath, settings),
1818
options: {},
1919
};
20+
this.applyRubyEnvFromConfiguration(exe, settings, config);
21+
return exe;
22+
}
23+
24+
private static applyRubyEnvFromConfiguration(
25+
exe: Executable,
26+
settings: ISettings,
27+
config: IConnectionConfiguration
28+
): Executable {
2029

2130
// setup defaults
2231
exe.options.env = this.shallowCloneObject(process.env);

0 commit comments

Comments
 (0)