MCPcopy Index your code
hub / github.com/LeetCode-OpenSource/vscode-leetcode / showProblem

Method showProblem

src/leetCodeExecutor.ts:103–116  ·  view source on GitHub ↗
(problemNode: IProblem, language: string, filePath: string, showDescriptionInComment: boolean = false, needTranslation: boolean)

Source from the content-addressed store, hash-verified

101 }
102
103 public async showProblem(problemNode: IProblem, language: string, filePath: string, showDescriptionInComment: boolean = false, needTranslation: boolean): Promise<void> {
104 const templateType: string = showDescriptionInComment ? "-cx" : "-c";
105 const cmd: string[] = [await this.getLeetCodeBinaryPath(), "show", problemNode.id, templateType, "-l", language];
106
107 if (!needTranslation) {
108 cmd.push("-T"); // use -T to force English version
109 }
110
111 if (!await fse.pathExists(filePath)) {
112 await fse.createFile(filePath);
113 const codeTemplate: string = await this.executeCommandWithProgressEx("Fetching problem data...", this.nodeExecutable, cmd);
114 await fse.writeFile(filePath, codeTemplate);
115 }
116 }
117
118 /**
119 * This function returns solution of a problem identified by input

Callers 2

activateFunction · 0.80
showProblemInternalFunction · 0.80

Calls 2

getLeetCodeBinaryPathMethod · 0.95

Tested by

no test coverage detected