-
Notifications
You must be signed in to change notification settings - Fork 51
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
feature: Added support for opting out endpoint translation #56
Conversation
I changed to branch develop. |
Thank you for your comment! The idea of -T is to provide vscode-leetcode the ability to let user choose whether or not they would like to see untranslated questions. This will allow users to see english version of the questions even though they are on the leetcode-cn endpoint. Because of the existence of caching mechanism, switching between -T and no -T require doing a ./leetcode cache -d. An example would be: |
Can we clean the cache or only the maybe add a flag
|
That may not be a good idea, usually a user might want to stick to a setting for a fairly long period of time. That means if one wants to use -T, he/she may stick with -T for quite a while, so clearing the cache internally would render the cache obsolete. |
That's why I think we can add one flag or something else to solve it. |
Ohh sorry I missed that line. It's a good idea, we can probably make it so that if the cache sees the translation mode has changed it will automatically invalidate it. But adding this flag might cause some compatibility issues, I will take a closer look tomorrow. |
@yihong0618 I just made a new commit which made some modification to the cache module. Now it will invalidate all caches automatically if the the old cache's -T config is different than requested. Also can you please take a look again at #55 , I fixed the const problem as well. |
Will take a look and test later today. |
Fixed some translation issue Continue to fix some translation problem fix: fixed test cases Fixed all test cases relating to getProblem(s) to adapt new parameter fix: fixed test_leetcode testcase
Thanks, I just rebased this branch onto the latest master, to make merge easier. |
LGTM for now. But one question: |
Thank you for the review! It's implemented already, I added a new checkable option in the setting page. Once this repo is upgraded in npm, I can open that PR. |
Got it. Thanks. |
@jdneo Hi, can you help me and take a look at this PR please? It provides a new option in the cli tool which later frontend can rely on to give users the ability to skip end point translations. |
@dzz007 Is this used to specify the language of leetcode-cn (Chinese -> English), how about leetcode US? |
@jdneo Thanks for replying, yes, for the leetcode US it won't have any impact at all. I tested it and it works fine for US endpoint. |
Ok, we should always be careful when adding new argument (for future compatibility and extensibility) Currently, -T will translate Chinese to English for LeetCode CN, what if in the future a new language appear? (though I'm not sure whether LeetCode will plan to do it or not). Do we need to follow with the target language as a argument? |
Umm, I don't think it need an argument, currently the way this -T works is that:
|
Ok makes sense. I'll take a look later today. |
Thanks @dzz007! |
Thanks! @jdneo |
Added a new parameter '-T' which when specified in 'show', 'list', or 'submission', will disable the end point's translation to problem materials. This can be used by vscode-leetcode to allow user to opt out from translations. I will push a separate pull request to that repo later when the version on this repo is bumped.