Skip to content

Commit

Permalink
Merge pull request #1512 from tgodzik/debug-info2
Browse files Browse the repository at this point in the history
improvement: Print more info if metals fails
  • Loading branch information
tgodzik authored May 29, 2024
2 parents ba9693a + c5d5a2e commit aae4524
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion packages/metals-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,22 @@ export function deactivate(): Thenable<void> | undefined {
return currentClient?.stop();
}

function debugInformation(
serverVersion: string,
serverProperties: string[],
javaConfig: JavaConfig
) {
return ` Metals version: ${serverVersion}
Server properties: ${serverProperties}
Java configuration:
- coursier: ${javaConfig.coursier}
- coursier mirror: ${javaConfig.coursierMirrorFilePath}
- extra environment: ${javaConfig.extraEnv}
- java options: ${javaConfig.javaOptions}
- java path: ${javaConfig.javaPath}
`;
}

async function fetchAndLaunchMetals(
context: ExtensionContext,
serverVersion: string,
Expand Down Expand Up @@ -246,14 +262,26 @@ async function fetchAndLaunchMetals(
serverProperties,
javaConfig,
serverVersion
);
).catch((reason) => {
outputChannel.appendLine(
"Launching Metals failed with the following:"
);
outputChannel.appendLine(reason.message);
outputChannel.appendLine(
debugInformation(serverVersion, serverProperties, javaConfig)
);
throw reason;
});
},
(reason) => {
if (reason instanceof Error) {
outputChannel.appendLine(
"Downloading Metals failed with the following:"
);
outputChannel.appendLine(reason.message);
outputChannel.appendLine(
debugInformation(serverVersion, serverProperties, javaConfig)
);
}
const msg = (() => {
const proxy =
Expand Down

0 comments on commit aae4524

Please sign in to comment.