Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0109197

Browse files
Vigilansjdneo
authored andcommitted
feat: AddshowCommentDescription config (LeetCode-OpenSource#289)
1 parent9dbe4fd commit0109197

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

‎package-lock.json

Lines changed: 6 additions & 10 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,12 @@
262262
"scope":"application",
263263
"description":"Default language for solving the problems."
264264
},
265+
"leetcode.showCommentDescription": {
266+
"type":"boolean",
267+
"default":false,
268+
"scope":"application",
269+
"description":"Include problem description in comments."
270+
},
265271
"leetcode.showSetDefaultLanguageHint": {
266272
"type":"boolean",
267273
"default":true,
@@ -344,6 +350,6 @@
344350
"markdown-it":"^8.4.2",
345351
"require-from-string":"^2.0.2",
346352
"unescape-js":"^1.1.1",
347-
"vsc-leetcode-cli":"2.6.4"
353+
"vsc-leetcode-cli":"2.6.5"
348354
}
349355
}

‎src/commands/show.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ async function showProblemInternal(node: IProblem): Promise<void> {
115115
outDir=path.join(outDir,relativePath);
116116
awaitfse.ensureDir(outDir);
117117

118-
constoriginFilePath:string=awaitleetCodeExecutor.showProblem(node,language,outDir);
118+
constoriginFilePath:string=awaitleetCodeExecutor.showProblem(node,language,outDir,leetCodeConfig.get<boolean>("showCommentDescription"));
119119
constfilePath:string=wsl.useWsl() ?awaitwsl.toWinPath(originFilePath) :originFilePath;
120120
awaitPromise.all([
121121
vscode.window.showTextDocument(vscode.Uri.file(filePath),{preview:false,viewColumn:vscode.ViewColumn.One}),

‎src/leetCodeExecutor.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,13 @@ class LeetCodeExecutor implements Disposable {
9494
);
9595
}
9696

97-
publicasyncshowProblem(problemNode:IProblem,language:string,outDir:string):Promise<string>{
97+
publicasyncshowProblem(problemNode:IProblem,language:string,outDir:string,detailed:boolean=false):Promise<string>{
9898
constfileName:string=genFileName(problemNode,language);
9999
constfilePath:string=path.join(outDir,fileName);
100+
consttemplateType:string=detailed ?"-cx" :"-c";
100101

101102
if(!awaitfse.pathExists(filePath)){
102-
constcodeTemplate:string=awaitthis.executeCommandWithProgressEx("Fetching problem data...",this.nodeExecutable,[awaitthis.getLeetCodeBinaryPath(),"show",problemNode.id,"-cx","-l",language]);
103+
constcodeTemplate:string=awaitthis.executeCommandWithProgressEx("Fetching problem data...",this.nodeExecutable,[awaitthis.getLeetCodeBinaryPath(),"show",problemNode.id,templateType,"-l",language]);
103104
awaitfse.writeFile(filePath,codeTemplate);
104105
}
105106

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp