Skip to content

Commit

Permalink
Set lemminx debug flag when debugging lemminx
Browse files Browse the repository at this point in the history
Signed-off-by: David Thompson <[email protected]>
  • Loading branch information
datho7561 authored and rgrunber committed Apr 23, 2021
1 parent 019b56b commit 0a7a024
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"outFiles": ["${workspaceRoot}/dist/**/*.js"],
"preLaunchTask": "npm: watch",
"env": {
"VSCODE_REDHAT_TELEMETRY_DEBUG": "true"
"VSCODE_REDHAT_TELEMETRY_DEBUG": "true",
"LEMMINX_DEBUG": "1"
}
},
{
Expand All @@ -27,7 +28,8 @@
"preLaunchTask": "npm: watch",
"env": {
"SUSPEND_SERVER": "true",
"VSCODE_REDHAT_TELEMETRY_DEBUG": "true"
"VSCODE_REDHAT_TELEMETRY_DEBUG": "true",
"LEMMINX_DEBUG": "1"
}
},
{
Expand Down
16 changes: 14 additions & 2 deletions src/server/binary/binaryServerStarter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ export const ABORTED_ERROR: Error = new Error('XML Language Server download canc
export async function prepareBinaryExecutable(context: ExtensionContext): Promise<Executable> {
const binaryArgs: string = getXMLConfiguration().get("server.binary.args");
let binaryExecutable: Executable;
const proxySettings: ProxySettings = getProxySettings();
return getServerBinaryPath()
.then((binaryPath: string) => {
binaryExecutable = {
args: [binaryArgs],
command: binaryPath,
options: {
env: (proxySettings ? getProxySettingsAsEnvironmentVariables(proxySettings) : {})
env: getBinaryEnvironment()
}
} as Executable;
return binaryPath;
Expand Down Expand Up @@ -171,6 +170,19 @@ async function checkBinaryHash(binaryPath: string): Promise<boolean> {
});
}

/**
* Returns the environment variables to use to run the server as an object
*
* @returns the environment variables to use to run the server as an object
*/
function getBinaryEnvironment(): any {
const proxySettings: ProxySettings = getProxySettings();
if (proxySettings) {
return { ...process.env, ...getProxySettingsAsEnvironmentVariables(proxySettings) };
}
return process.env;
}

/**
* Returns the name of the server binary file for the current OS and architecture
*
Expand Down

0 comments on commit 0a7a024

Please sign in to comment.