Skip to content

Commit 8ac0287

Browse files
Vigilansjdneo
authored andcommitted
1 parent b90354e commit 8ac0287

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

package-lock.json

+16-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@
337337
"lodash": "^4.17.11",
338338
"markdown-it": "^8.4.2",
339339
"require-from-string": "^2.0.2",
340+
"unescape-js": "^1.1.1",
340341
"vsc-leetcode-cli": "2.6.3"
341342
}
342343
}

src/commands/show.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import * as fse from "fs-extra";
55
import * as path from "path";
6+
import * as unescapeJS from "unescape-js";
67
import * as vscode from "vscode";
78
import { LeetCodeNode } from "../explorer/LeetCodeNode";
89
import { leetCodeChannel } from "../leetCodeChannel";
@@ -49,11 +50,10 @@ export async function showSolution(node?: LeetCodeNode): Promise<void> {
4950
return;
5051
}
5152
try {
52-
let solution: string = await leetCodeExecutor.showSolution(node, language);
53-
// remove backslash in espaced \'...\'(generated by leetcode's database)
54-
solution = solution.replace(/\\'/g, "'");
55-
await leetCodeSolutionProvider.show(solution, node);
53+
const solution: string = await leetCodeExecutor.showSolution(node, language);
54+
await leetCodeSolutionProvider.show(unescapeJS(solution), node);
5655
} catch (error) {
56+
leetCodeChannel.appendLine(error.toString());
5757
await promptForOpenOutputChannel("Failed to fetch the top voted solution. Please open the output channel for details.", DialogType.error);
5858
}
5959
}

0 commit comments

Comments
 (0)