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

[Question] My code disappeared strangely. #72

Closed
shaojunjie0912 opened this issue Mar 9, 2024 · 6 comments
Closed

[Question] My code disappeared strangely. #72

shaojunjie0912 opened this issue Mar 9, 2024 · 6 comments

Comments

@shaojunjie0912
Copy link

shaojunjie0912 commented Mar 9, 2024

When learning of data structures and algorithms, I usually write notes through code comments.

When I reopened the file via leetcode after committing the code, I found that my file was overwritten and all the code and comments I wrote earlier in this file is all gone.

Is there any way to prevent the leetcode plugin overwriting my code?

Thanks a lot!

@kawre
Copy link
Owner

kawre commented Mar 9, 2024

Every time you open a question, it will reset the question if the file already existed. But this reset is not permanent, it only reset lines in buffer, so to undo it you just have to press u or :undo.

Do you have logger inside config disabled by any chance, because every time it does get reset, leetcode.nvim will notify the stuff i just mentioned above.

But I've changed it to only reset lines if status of question is accepted.

@shaojunjie0912
Copy link
Author

Thanks for the latest commit, everything is working fine now!

@MasouShizuka
Copy link

Can this be set as a config item?
It's not very inconvenient at the moment.

In fact, I don't want leetcode.nvim to automatically reset at any time.
When I need to reset, I will manually: Leet reset

@shaojunjie0912
Copy link
Author

Can this be set as a config item? It's not very inconvenient at the moment.

In fact, I don't want leetcode.nvim to automatically reset at any time. When I need to reset, I will manually: Leet reset

Have you updated the plugin? The latest version is that it will not be reset by default.

@MasouShizuka
Copy link

What I mean is that those questions that have passed should not be reset automatically.

@MasouShizuka
Copy link

MasouShizuka commented Mar 11, 2024

As for why automatic reset is bad, take me as an example:
First of all, I wrote my own ideas in the code. When I re-check the passed questions, I need to press u to reset every time, which is not convenient.
In addition, I use the autosave plugin, which means that the files are automatically saved every time after reset. If neovim exits abnormally at this time, the content of the question will be lost.

So I think it would make sense to at least make this feature configurable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants