Skip to content

Fix the unable to login problem each time VSCode starts #212

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 2 commits into from
Mar 17, 2019

Conversation

houtianze
Copy link
Contributor

@houtianze houtianze commented Mar 17, 2019

First, thanks for this awesome plugin 👍

The change is just one line.

The Problem

  • Each time I (re)started VS Code, the extension asks me to login to leetcode.com, though I can see from the directory ~/.lc that the user secrets have been previously saved.

The Cause

  • Because the leetcode.cn leetcode-cli plugin is not installed by default with this extension, and if the user has never installed it manually (which most of the time is the case), on line 62 in extension.ts: this call await leetCodeExecutor.switchEndpoint(plugin.getLeetCodeEndpoint()); will throw an exception (because it will eventually try to disable the leetcode.cn plugin, which has not been installed) and the next line which is to load the leetcode user information won't get executed (or error out? I didn't debug further).

The Fix

  • Installs leetcode.cn leetcode-cli plugin by default.

@Vigilans Vigilans self-requested a review March 17, 2019 07:31
Vigilans
Vigilans previously approved these changes Mar 17, 2019
Copy link
Contributor

@Vigilans Vigilans left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.

The commit you made has already been covered in a review in another PR: #193 (comment), in which I brought up with a solution but did not get shipped in the latest version.

However, although I know how to suppress the problem, I didn't figure out how the problem([ERROR] Plugin not found!) comes up, and the same problem has been reported by many users in #211.

Your analysis essentially solves my doubt. I then test executing leetcode plugin -d leetcode.cn in a new machine, and the error Plugin not found was popped out as expected.

I can make sure your commit will solve both your problem and one that's discussed above. Good work!

@Vigilans Vigilans requested a review from jdneo March 17, 2019 07:48
@Vigilans Vigilans added this to the 0.13.1 milestone Mar 17, 2019
Copy link
Member

@jdneo jdneo left a comment

Choose a reason for hiding this comment

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

@houtianze Great work! :shipit:

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.

3 participants