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

Cs/defaultlanguage#7

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

Merged
jdneo merged 2 commits intomasterfromcs/defaultlanguage
Feb 23, 2018
Merged
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
36 changes: 35 additions & 1 deletionpackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -118,7 +118,41 @@
"when": "never"
}
]
}
},
"configuration": [
{
"title": "LeetCode",
"properties": {
"leetcode.defaultLanguage": {
"type": "string",
"enum": [
"bash",
"c",
"cpp",
"csharp",
"golang",
"java",
"javascript",
"kotlin",
"mysql",
"python",
"python3",
"ruby",
"scala",
"swift"
],
"scope": "window",
"description": "Default language preference for solving the problems."
},
"leetcode.showSetDefaultLanguageHint": {
"type": "boolean",
"default": true,
"scope": "window",
"description": "Show a hint to let user set the default language preference."
}
}
}
]
},
"scripts": {
"vscode:prepublish": "npm run compile",
Expand Down
22 changes: 20 additions & 2 deletionssrc/commands/show.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,7 +6,7 @@ import { LeetCodeNode } from "../leetCodeExplorer";
import { leetCodeManager } from "../leetCodeManager";
import { IQuickItemEx, languages, leetCodeBinaryPath } from "../shared";
import { executeCommand } from "../utils/cpUtils";
import { DialogType, promptForOpenOutputChannel, promptForSignIn } from "../utils/uiUtils";
import {DialogOptions,DialogType, promptForOpenOutputChannel, promptForSignIn } from "../utils/uiUtils";
import { selectWorkspaceFolder } from "../utils/workspaceUtils";
import * as list from "./list";

Expand DownExpand Up@@ -37,10 +37,28 @@ export async function searchProblem(channel: vscode.OutputChannel): Promise<void

async function showProblemInternal(channel: vscode.OutputChannel, id: string): Promise<void> {
try {
const language: string | undefined = await vscode.window.showQuickPick(languages, { placeHolder: "Select the language you want to use" });
const leetCodeConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("leetcode");
let defaultLanguage = leetCodeConfig.get<string>("defaultLanguage");
if (defaultLanguage && languages.indexOf(defaultLanguage) < 0) {
defaultLanguage = undefined;
}
const language: string | undefined = defaultLanguage || await vscode.window.showQuickPick(languages, { placeHolder: "Select the language you want to use" });
if (!language) {
return;
}
if (!defaultLanguage && leetCodeConfig.get<boolean>("showSetDefaultLanguageHint")) {
const choice: vscode.MessageItem | undefined = await vscode.window.showInformationMessage(
`Would you like to set '${language}' as your default language?`,
DialogOptions.yes,
DialogOptions.no,
DialogOptions.never,
);
if (choice === DialogOptions.yes) {
leetCodeConfig.update("defaultLanguage", language, true /* UserSetting */);
} else if (choice === DialogOptions.never) {
leetCodeConfig.update("showSetDefaultLanguageHint", false, true /* UserSetting */);
}
}
const outdir: string = await selectWorkspaceFolder();
await fse.ensureDir(outdir);
const result: string = await executeCommand(channel, "node", [leetCodeBinaryPath, "show", id, "-gx", "-l", language, "-o", outdir]);
Expand Down
1 change: 1 addition & 0 deletionssrc/utils/uiUtils.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@ export namespace DialogOptions {
export const open: vscode.MessageItem = { title: "Open" };
export const yes: vscode.MessageItem = { title: "Yes" };
export const no: vscode.MessageItem = { title: "No", isCloseAffordance: true };
export const never: vscode.MessageItem = { title: "Never" };
export const singUp: vscode.MessageItem = { title: "Sign up" };
}

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp