Skip to content
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

Open an existing file instead of creating a new one when showing the problem #59

Closed
evan-lin9 opened this issue Aug 15, 2018 · 10 comments
Closed
Labels
enhancement New feature or request
Milestone

Comments

@evan-lin9
Copy link

image

@jdneo
Copy link
Member

jdneo commented Aug 15, 2018

不太确定我有没有正确理解的你的问题。

你可以试试在VS Code里,点击File > Open Folder..., 然后选择目标文件夹(默认情况下所有题目会存储在$HOME/.leetcode/),这个时候你就可以在VS Code里看到所有文件了。

image

@jdneo jdneo added the help wanted Extra attention is needed label Aug 24, 2018
@twchn
Copy link

twchn commented Oct 9, 2018

不太确定我有没有正确理解的你的问题。

你可以试试在VS Code里,点击File > Open Folder..., 然后选择目标文件夹(默认情况下所有题目会存储在$HOME/.leetcode/),这个时候你就可以在VS Code里看到所有文件了。

image

我觉得在点击show problem时先判断一下本地有没有文件再来决定打开本地文件(如果本地有)或者拉取题目(如果本地没有)这样好一点,因为这样可以看到之前的草稿或者提交的答案

@jdneo
Copy link
Member

jdneo commented Oct 10, 2018

@taoweicn This is a good suggestion.

@SkyLin0909 Do you mean to make the extension work as @taoweicn said?

@evan-lin9
Copy link
Author

@jdneo yes

@jdneo jdneo added enhancement New feature or request and removed help wanted Extra attention is needed labels Oct 10, 2018
@twchn twchn mentioned this issue Jan 25, 2019
5 tasks
@poppinlp
Copy link
Contributor

@jdneo Hi,请问这是一个 PR-welcomed 的 issue 么?

@jdneo
Copy link
Member

jdneo commented Feb 21, 2019

@poppinlp All the issues are PR welcomed. Just remember to discuss the implementation in the issue before sending out the PR.

Thanks

@poppinlp
Copy link
Contributor

@jdneo
Thanks. Nice!
I've looked into the code about this issue since it really bothers me.

This issue is caused by the params we passed into the show API of leetcode-cli which will generate a new source code file every time. And i haven't seen a param for existence checking in show API.

So here may be some plans:

A: We could genearte the file name by ourself and by which we could do the existence checking to determine whether to use the local code or get the remote template by show API from leetcode-cli.

This could solve this problem but we may meet some new problems too:

  • generating file name by id and slug which should be compatible with the present
  • mapping the file extension with language

B: We could use show API to generate source file in a temp path and by which we could get the file name. Then do the existence checking.

It's a little bit simple solution but may cost more time since we will always call the API.

So, what's your option about this? I prefer the plan A and i feel free for any ideas. :)

@jdneo
Copy link
Member

jdneo commented Feb 22, 2019

@poppinlp Plan A sounds good to me. Would you like to make a PR for it?

@poppinlp
Copy link
Contributor

Of course. I'll send it this weekend. :)

@jdneo
Copy link
Member

jdneo commented Feb 24, 2019

Has been addressed with the help of @poppinlp in #149.

Will release in 0.11.0

@jdneo jdneo closed this as completed Feb 24, 2019
@jdneo jdneo added this to the 0.11.0 milestone Feb 24, 2019
@jdneo jdneo changed the title 如何在show problem时,读取本地文件,而不是新建一个? Open an existing file instead of creating a new one when showing the problem Feb 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants