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

fix: #593 by adding global flag to remove cache#602

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 3 commits intoLeetCode-OpenSource:masterfromyihong0618:master
Jul 23, 2020
Merged

fix: #593 by adding global flag to remove cache#602

jdneo merged 3 commits intoLeetCode-OpenSource:masterfromyihong0618:master
Jul 23, 2020

Conversation

yihong0618
Copy link
Contributor

No description provided.

@yihong0618
Copy link
ContributorAuthor

@jdneo
fix:#593#590

public async meetRequirements(context: ExtensionContext): Promise<boolean> {
const isUserFresh: boolean | undefined = context.globalState.get(globalStateLeetcodeIsUserFresh);
if (isUserFresh !== false) {
await this.removeOldCache();
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Seems a little different.The command way use leetcode-cli way not delete the whole dir, let me check if it works fine too.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@jdneo
delete cache only delete the user session but not the plugin.js cache, still have that issue. So I think we can not use it..
image

Copy link
Member

@jdneojdneoJul 22, 2020
edited
Loading

Choose a reason for hiding this comment

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

Maybe we need to change the implementation of the commanddelete cache. Considering that the current implementation does not clean entirely?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, current one only clean the user info(include session), but we change thedelete cache also have one problem beacuse user may have two account one leetcode one leetcode-cn, if we change that. both will clean, but user may only want to clean the current cache.

Copy link
Member

Choose a reason for hiding this comment

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

I see. So let's keep the implementation. Maybe later we can provide two option in this command. Something likeSession andAll. Anyway it's not a high priority

public async meetRequirements(): Promise<boolean> {
public async meetRequirements(context: ExtensionContext): Promise<boolean> {
const isUserFresh: boolean | undefined = context.globalState.get(globalStateLeetcodeIsUserFresh);
if (isUserFresh !== false) {
Copy link
Member

Choose a reason for hiding this comment

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

if (!isUserFresh)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

if (!isUserFresh)

@jdneo
Seems not the same logic if use if (!isUserFresh)

await this.executeCommandEx(this.nodeExecutable, [await this.getLeetCodeBinaryPath(), "plugin", "-i", plugin]);
}
}
context.globalState.update(globalStateLeetcodeIsUserFresh, false);
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

In the end of activate() I set it to false, in the first it should be undefined so I use(isUserFresh !== false) logic to check.

Copy link
Member

Choose a reason for hiding this comment

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

Then instead of calling itisUserFresh, it would be better to call itHasInited IMO. And set it totrue at the end ofactivate()

The aim of that is to avoid the two falsy valueundefined andfalse has two different meanings.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Got it.

@@ -84,7 +85,7 @@ class LeetCodeExecutor implements Disposable {
}

public async signOut(): Promise<string> {
return await await this.executeCommandEx(this.nodeExecutable, [await this.getLeetCodeBinaryPath(), "user", "-L"]);
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

It seems that its an old typo so I changed it too, am I right?

Copy link
Member

Choose a reason for hiding this comment

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

yes

src/shared.ts Outdated
@@ -114,3 +114,5 @@ export enum DescriptionConfiguration {
Both = "Both",
None = "None",
}

export const globalStateLeetcodeHasInited: string = "leetcode.isUserFresh";
Copy link
Member

@jdneojdneoJul 23, 2020
edited
Loading

Choose a reason for hiding this comment

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

Please also change the value. No need to have the prefixglobalState I think. Since when you calling the API, that API name already tells it's a global state

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Got it~!

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Fixed.

Copy link
Member

@jdneojdneo left a comment

Choose a reason for hiding this comment

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

Thanks@yihong0618 !

yihong0618 reacted with thumbs up emoji
@jdneojdneo merged commit1893d34 intoLeetCode-OpenSource:masterJul 23, 2020
@jdneojdneo added this to the0.17.1 milestoneJul 23, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jdneojdneojdneo approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
0.18.0
Development

Successfully merging this pull request may close these issues.

2 participants
@yihong0618@jdneo

[8]ページ先頭

©2009-2025 Movatter.jp