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

Commitfeae070

Browse files
sheche@microsoft.comsheche@microsoft.com
sheche@microsoft.com
authored and
sheche@microsoft.com
committed
prompt set default language at the end of show command
1 parent3a0a0cb commitfeae070

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

‎src/commands/show.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ async function showProblemInternal(channel: vscode.OutputChannel, id: string): P
4646
if(!language){
4747
return;
4848
}
49+
50+
constoutdir:string=awaitselectWorkspaceFolder();
51+
awaitfse.ensureDir(outdir);
52+
constresult:string=awaitexecuteCommand(channel,"node",[leetCodeBinaryPath,"show",id,"-gx","-l",language,"-o",outdir]);
53+
constreg:RegExp=/\*SourceCode:\s*(.*)/;
54+
constmatch:RegExpMatchArray|null=result.match(reg);
55+
if(match&&match.length>=2){
56+
awaitvscode.window.showTextDocument(vscode.Uri.file(match[1].trim()),{preview:false});
57+
}else{
58+
thrownewError("Failed to fetch the problem information");
59+
}
60+
4961
if(!defaultLanguage&&leetCodeConfig.get<boolean>("showSetDefaultLanguageHint")){
5062
constchoice:vscode.MessageItem|undefined=awaitvscode.window.showInformationMessage(
5163
`Would you like to set '${language}' as your default language?`,
@@ -59,16 +71,6 @@ async function showProblemInternal(channel: vscode.OutputChannel, id: string): P
5971
leetCodeConfig.update("showSetDefaultLanguageHint",false,true/* UserSetting */);
6072
}
6173
}
62-
constoutdir:string=awaitselectWorkspaceFolder();
63-
awaitfse.ensureDir(outdir);
64-
constresult:string=awaitexecuteCommand(channel,"node",[leetCodeBinaryPath,"show",id,"-gx","-l",language,"-o",outdir]);
65-
constreg:RegExp=/\*SourceCode:\s*(.*)/;
66-
constmatch:RegExpMatchArray|null=result.match(reg);
67-
if(match&&match.length>=2){
68-
awaitvscode.window.showTextDocument(vscode.Uri.file(match[1].trim()),{preview:false});
69-
}else{
70-
thrownewError("Failed to fetch the problem information");
71-
}
7274
}catch(error){
7375
awaitpromptForOpenOutputChannel("Failed to fetch the problem information. Please open the output channel for details",DialogType.error,channel);
7476
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp