Skip to content

feat: Add 'show solution' in editor context menu & code lens #313

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 10, 2019

Conversation

jdneo
Copy link
Member

@jdneo jdneo commented May 8, 2019

Resolve #269

demo

Need to release cli first.

@jdneo jdneo added this to the 0.14.2 milestone May 8, 2019
@jdneo jdneo requested review from poppinlp and Vigilans May 8, 2019 11:48
return;
}

const language: string | undefined = await fetchProblemLanguage();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could utilize file extension (path.extName()) and shared.ts/langExt to determine the language, thus no need for re-selecting the language when showing solution from the code:

export const langExt: Map<string, string> = new Map([
    ["bash", "sh"],
    ["c", "c"],
    ["cpp", "cpp"],
    ["csharp", "cs"],
    ["golang", "go"],
    ["java", "java"],
    ["javascript", "js"],
    ["kotlin", "kt"],
    ["mysql", "sql"],
    ["php", "php"],
    ["python", "py"],
    ["python3", "py"],
    ["ruby", "rb"],
    ["rust", "rs"],
    ["scala", "scala"],
    ["swift", "swift"],
]);

(Yet this choice comes with a risk: currently showing solution for languages like scala has a high probability to fail. This feature could be added in later PR when logic of solution plugin is improved.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another rick is that it's hard to differentiate py3 & py2 from the extName

@jdneo jdneo merged commit 4ad07a8 into master May 10, 2019
@jdneo jdneo deleted the cs/solution branch May 10, 2019 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a "show top solution" item to the right click menu, pls
2 participants