Skip to content

Commit 1424277

Browse files
committed
Resolve #261
1 parent 781feb2 commit 1424277

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/commands/show.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ export async function showSolution(node?: LeetCodeNode): Promise<void> {
5050
}
5151
try {
5252
let solution: string = await leetCodeExecutor.showSolution(node, language);
53-
// remove backslash in espaced \'...\'(generated by leetcode's database)
54-
solution = solution.replace(/\\'/g, "'");
53+
// tslint:disable-next-line: no-eval
54+
solution = eval(`"${solution.replace(/\n/g, "\\n")}"`); // decode solution string with escaped characters
5555
await leetCodeSolutionProvider.show(solution, node);
5656
} catch (error) {
57+
leetCodeChannel.appendLine(error.toString());
5758
await promptForOpenOutputChannel("Failed to fetch the top voted solution. Please open the output channel for details.", DialogType.error);
5859
}
5960
}

0 commit comments

Comments
 (0)