p00f / cphelper.nvim

Neovim helper for competitive programming. Use https://sr.ht/~p00f/cphelper.nvim instead
MIT License
133 stars 9 forks source link

Allow parsing contest #21

Open qixiao986 opened 2 years ago

qixiao986 commented 2 years ago

When I start neovim, CphReceive one problem is ok, but if I CphReceive another problem, it does nothing, I have to restart the neovim and it receive again. looks like it can only receive one problem in one session. I check the source code, find here: https://github.com/p00f/cphelper.nvim/blob/7d18ff6ba83ca80ee25abedfdf616e69000cef17/lua/cphelper/receive.lua#L37

looks like the server didn't close like the client, so I add this: M.server:close() and it worked properly. please check if this is a bug.

qixiao986 commented 2 years ago

or we can move this line out of the function and don't close, that will receive multi problem without retype CphReceive, that's very handy. https://github.com/p00f/cphelper.nvim/blob/7d18ff6ba83ca80ee25abedfdf616e69000cef17/lua/cphelper/receive.lua#L9

p00f commented 2 years ago

or we can move this line out of the function and don't close, that will receive multi problem without retype CphReceive, that's very handy.

Keeping the server on would be a waste of resources right?

qixiao986 commented 2 years ago

or we can move this line out of the function and don't close, that will receive multi problem without retype CphReceive, that's very handy.

Keeping the server on would be a waste of resources right?

yeah, but to me it's very convenient and more suits my needs.

p00f commented 2 years ago

It takes like 1 second to :CphReceive again (write :Cp and tab through), so I won't change this. I added M.server:close() and fixed the issue, thanks!

qixiao986 commented 2 years ago

It takes like 1 second to :CphReceive again (write :Cp and tab through), so I won't change this. I added M.server:close() and fixed the issue, thanks!

I have another reason why we should keep server open, if we want parse contest, that will need us to receive multi problem at once, if the server close it can only receive the first problem. you can try to parse a codeforces contest, like this link:Codeforces Round #779 (Div. 2)