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

feat: Add support for Cursor editor authentication#998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
cry0404 wants to merge1 commit intoLeetCode-OpenSource:master
base:master
Choose a base branch
Loading
fromcry0404:feature/add-cursor-support
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionsrc/leetCodeExecutor.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,7 @@ import * as cp from "child_process";
import * as fse from "fs-extra";
import * as os from "os";
import * as path from "path";
import* asrequireFromString from "require-from-string";
import requireFromString from "require-from-string";
import { ExtensionContext } from "vscode";
import { ConfigurationChangeEvent, Disposable, MessageItem, window, workspace, WorkspaceConfiguration } from "vscode";
import { Endpoint, IProblem, leetcodeHasInited, supportedPlugins } from "./shared";
Expand Down
28 changes: 25 additions & 3 deletionssrc/shared.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -125,15 +125,37 @@ export enum SortingStrategy {
export const PREMIUM_URL_CN = "https://leetcode.cn/premium-payment/?source=vscode";
export const PREMIUM_URL_GLOBAL = "https://leetcode.com/subscribe/?ref=lp_pl&source=vscode";

const protocol = vscode.env.appName.includes('Insiders') ? "vscode-insiders" : "vscode"
// 检测当前编辑器环境并返回对应的协议和扩展标识
const getEditorInfo = () => {
const appName = vscode.env.appName;
if (appName.includes('Cursor')) {
return {
protocol: "cursor",
extensionId: "leetcode.vscode-leetcode" // Cursor 兼容 VSCode 扩展标识
};
} else if (appName.includes('Insiders')) {
return {
protocol: "vscode-insiders",
extensionId: "leetcode.vscode-leetcode"
};
} else {
return {
protocol: "vscode",
extensionId: "leetcode.vscode-leetcode"
};
}
};

const editorInfo = getEditorInfo();
const protocol = editorInfo.protocol;

export const urls = {
// base urls
base: "https://leetcode.com",
graphql: "https://leetcode.com/graphql",
userGraphql: "https://leetcode.com/graphql",
login: "https://leetcode.com/accounts/login/",
authLoginUrl: `https://leetcode.com/authorize-login/${protocol}/?path=leetcode.vscode-leetcode`,
authLoginUrl: `https://leetcode.com/authorize-login/${protocol}/?path=${editorInfo.extensionId}`,
};

export const urlsCn = {
Expand All@@ -142,7 +164,7 @@ export const urlsCn = {
graphql: "https://leetcode.cn/graphql",
userGraphql: "https://leetcode.cn/graphql/",
login: "https://leetcode.cn/accounts/login/",
authLoginUrl: `https://leetcode.cn/authorize-login/${protocol}/?path=leetcode.vscode-leetcode`,
authLoginUrl: `https://leetcode.cn/authorize-login/${protocol}/?path=${editorInfo.extensionId}`,
};

export const getUrl = (key: string) => {
Expand Down
2 changes: 1 addition & 1 deletionsrc/webview/markdownEngine.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@
// Licensed under the MIT license.

import * as hljs from "highlight.js";
import* asMarkdownIt from "markdown-it";
import MarkdownIt from "markdown-it";
import * as os from "os";
import * as path from "path";
import * as vscode from "vscode";
Expand Down
5 changes: 4 additions & 1 deletiontsconfig.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,10 @@
"noImplicitReturns": true,
"strictNullChecks": true,
"noUnusedParameters": true,
"alwaysStrict": true
"alwaysStrict": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true
},
"exclude": [
"node_modules",
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp