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

Commit f5c8e7f

Browse files
committed
Fix LGTM warning
1 parent 825ca17 commit f5c8e7f

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

‎src/webview/leetCodePreviewProvider.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// Licensed under the MIT license.
33

44
import { commands, ViewColumn } from "vscode";
5-
import { IProblem } from "../shared";
5+
import { getLeetCodeEndpoint } from "../commands/plugin";
6+
import { Endpoint, IProblem } from "../shared";
67
import { ILeetCodeWebviewOption, LeetCodeWebview } from "./LeetCodeWebview";
78
import { markdownEngine } from "./markdownEngine";
89

@@ -180,21 +181,18 @@ class LeetCodePreviewProvider extends LeetCodeWebview {
180181
}
181182

182183
private getDiscussionLink(url: string): string {
183-
if (url.includes("leetcode-cn.com")) {
184+
const endPoint: string = getLeetCodeEndpoint();
185+
if (endPoint === Endpoint.LeetCodeCN) {
184186
return url.replace("/description/", "/comments/");
185-
} else if (url.includes("leetcode.com")) {
187+
} else if (endPoint===Endpoint.LeetCode) {
186188
return url.replace("/description/", "/discuss/?currentPage=1&orderBy=most_votes&query=");
187189
}
188190

189191
return "https://leetcode.com";
190192
}
191193

192194
private getSolutionLink(url: string): string {
193-
if (url.includes("leetcode-cn.com") || url.includes("leetcode.com")) {
194-
return url.replace("/description/", "/solution/");
195-
}
196-
197-
return "https://leetcode.com";
195+
return url.replace("/description/", "/solution/");
198196
}
199197
}
200198

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /