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

Commit1e1d8a0

Browse files
committed
fix: replacediscuss->solution in solution URL
1 parentd713ad5 commit1e1d8a0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎src/webview/leetCodeSolutionProvider.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,23 @@ class LeetCodeSolutionProvider extends LeetCodeWebview {
7777
[solution.author,raw]=raw.match(/\*Author:\s+(.+)\n([^]+)/)!.slice(1);
7878
[solution.votes,raw]=raw.match(/\*Votes:\s+(\d+)\n\n([^]+)/)!.slice(1);
7979
solution.body=raw;
80+
81+
solution.url=replaceUrlDiscussWithSolution(solution.url);
82+
8083
returnsolution;
8184
}
8285
}
8386

87+
functionreplaceUrlDiscussWithSolution(url:string):string{
88+
// This is due to the update of leetcode.com on 2022 Dec
89+
// "vsc-leetcode-cli": "2.8.1" is still using "discuss" instead of "solutions" in URL
90+
// this will have the vsc-leetcode-cli updating URL to "solutions"
91+
returnurl.replace(
92+
/https:\/\/leetcode.com\/problems\/(.+)\/discuss\/(\d+)/,
93+
"https://discuss.leetcode.com/problem/$1/solutions/$2"
94+
);
95+
}
96+
8497
// tslint:disable-next-line:max-classes-per-file
8598
classSolution{
8699
publictitle:string="";

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp