Skip to content

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

Closed
@evan-lin9

Description

@evan-lin9

image

Activity

jdneo

jdneo commented on Aug 15, 2018

@jdneo
Member

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

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

image

twchn

twchn commented on Oct 9, 2018

@twchn

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

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

image

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

jdneo

jdneo commented on Oct 10, 2018

@jdneo
Member

@taoweicn This is a good suggestion.

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

evan-lin9

evan-lin9 commented on Oct 10, 2018

@evan-lin9
Author

@jdneo yes

added
enhancementNew feature or request
and removed
help wantedExtra attention is needed
on Oct 10, 2018
poppinlp

poppinlp commented on Feb 21, 2019

@poppinlp
Contributor

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

jdneo

jdneo commented on Feb 21, 2019

@jdneo
Member

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

Thanks

poppinlp

poppinlp commented on Feb 21, 2019

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

jdneo commented on Feb 22, 2019

@jdneo
Member

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

poppinlp

poppinlp commented on Feb 22, 2019

@poppinlp
Contributor

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

5 remaining items

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @poppinlp@jdneo@evan-lin9@twchn

        Issue actions

          Open an existing file instead of creating a new one when showing the problem · Issue #59 · LeetCode-OpenSource/vscode-leetcode