Skip to content

Conversation

wendajiang
Copy link
Collaborator

  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

@clearloop
Copy link
Owner

clearloop commented Jul 4, 2022

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?

@wendajiang
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.

@clearloop
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

@wendajiang
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 clearloop merged commit 5566870 into clearloop:master Jul 9, 2022
@clearloop clearloop mentioned this pull request Jul 12, 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

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

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 => "⁰".to_string(),
1 => "¹".to_string(),
2 => "²".to_string(),
3 => "³".to_string(),
4 => "⁴".to_string(),
5 => "⁵".to_string(),
6 => "⁶".to_string(),
7 => "⁷".to_string(),
8 => "⁸".to_string(),
9 => "⁹".to_string(),
_ => n.to_string(),
}
}
Copy link
Owner

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

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

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
Labels
None yet
2 participants