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

Feat: like vsc-leetcode-cli use @lc code=start and @lc code=end to pick the code #77

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
clearloop merged 12 commits into clearloop:master from wendajiang:dev
Jul 9, 2022

Conversation

Copy link
Collaborator

@wendajiang wendajiang commented Jul 3, 2022

  1. edit add file include extra information
  2. remove test file, and use memory all_cases
  3. use scraper crate parser the desc html fragment

Besides, as I do not like auto create test file in the workspace, so this PR use Draft. And if someone need the @lc code=start feature, we can discuss how to merge to master.

PS. @lc code=start almost use for me to auto-completion code like this

#include <bits/stdc++.h>
using namespace std;
// @lc code=start
class Solution {
 public:
 vector<int> twoSum(vector<int>& nums, int target) {
 vector<int> result;
 unordered_map<int, int> mapping;
 for (int i = 0; i < nums.size(); i++) {
 mapping[nums[i]] = i;
 }
 for (int i = 0; i < nums.size(); i++) {
 int searched = target - nums[i];
 if (mapping.find(searched) != mapping.end() &&
 i != mapping[searched]) {
 result.push_back(i);
 result.push_back(mapping[searched]);
 break;
 }
 }
 return result;
 }
};
// @lc code=end

so that, when exec problem, only upload the content between @lc code = start and @lc code=end

Copy link
Owner

clearloop commented Jul 4, 2022
edited
Loading

thx!! @wendajiang

Besides, as I do not like auto create test file in the workspace, so this PR use Draft. And if someone need the @lc code=start feature, we can discuss how to merge to master.

Understand this concern, due to some users like to review their past code, I think we can add a flag to keep it? how do you think about the flag?

Copy link
Collaborator Author

thx!! @wendajiang

Besides, as I do not like auto create test file in the workspace, so this PR use Draft. And if someone need the @lc code=start feature, we can discuss how to merge to master.

Understand this concern, due to some users like to review their past code, I think we can add a flag to keep it? how do you think about the flag?

So do I, I would recover test file feature by default closing this weekend.

Copy link
Owner

So do I, I would recover test file feature by default closing this weekend.

Yeah and mb we can configure this in our config.toml, if need the test files

Copy link
Collaborator Author

So do I, I would recover test file feature by default closing this weekend.

Yeah and mb we can configure this in our config.toml, if need the test files

When i re-add the test file feature, I find the test file path use the code path, as i think it's ok, so re-use the config.
However, I change the code path in config file to absolute path that not use the root dir(distinguish the scripts and the problem db path).

And I do not add new config for opening/closing the test file, as I use edit subcommand arg like leetcode edit -t to detect generate the test case file or not.

And above all is finished.

clearloop and hao-lee reacted with heart emoji

@clearloop clearloop merged commit 5566870 into clearloop:master Jul 9, 2022
Comment on lines +25 to +26
pub const CODE_START: &str = r#"// @lc code=start"#;
pub const CODE_END: &str = r#"// @lc code=end"#;
Copy link
Owner

@clearloop clearloop Jul 12, 2022

Choose a reason for hiding this comment

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

shoud configure these in the config, the // can not be recognized by every programming languages

Copy link
Collaborator Author

@wendajiang wendajiang Jul 12, 2022

Choose a reason for hiding this comment

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

Yeah, you are right, // maybe wrong!

Comment on lines -114 to -129
pub fn superscript(n: u8) -> String {
match n {
x if x >= 10 => format!("{}{}", superscript(n / 10), superscript(n % 10)),
0 => "0".to_string(),
1 => "1".to_string(),
2 => "2".to_string(),
3 => "3".to_string(),
4 => "4".to_string(),
5 => "5".to_string(),
6 => "6".to_string(),
7 => "7".to_string(),
8 => "8".to_string(),
9 => "9".to_string(),
_ => n.to_string(),
}
}
Copy link
Owner

@clearloop clearloop Jul 12, 2022

Choose a reason for hiding this comment

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

plz check if scrapper can support this

Copy link
Collaborator Author

@wendajiang wendajiang Jul 12, 2022

Choose a reason for hiding this comment

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

however, I do not think is nessesary, and this relpace use ^ and _, if you think this must be use the utf-8 character, I can do some manual work to recover this. :)

Copy link
Owner

@clearloop clearloop Jul 12, 2022
edited
Loading

Choose a reason for hiding this comment

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

these optimizations are from #12 and #39, we better to keep these for respecting the previous contributors, btw, I think there is a escraper in our crate also lol #11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@clearloop clearloop clearloop left review comments

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

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /