xeluxee / competitest.nvim

CompetiTest.nvim is a Neovim plugin for Competitive Programming: it can manage and check testcases, download problems and contests from online judges and much more
GNU Lesser General Public License v3.0
381 stars 15 forks source link

CompetiTestReceive enhancements #28

Closed MuhammadSawalhy closed 11 months ago

MuhammadSawalhy commented 1 year ago

I am so happy to see new features in this amazing NeoVim plugin. I found that CompetiTestReceive requires an argument and we can receive a problem or even a contest. But we need more work on this command.

I know that you are planning to add a custom template when a problem file is created and here are some features I really need.

1. Cancel fetching a contest or a problem

I was fetching a problem and wanted to exit the directory prompt by pressing Esc but it didn't work.

2. Default directory

We need more configuration to the custom directory for each online judge, I used to add problems in its own directory and inside its online judge directory. I saw some people also do this not only me. This is what my directories structure looks like:

├── <online judge>
    ├── <contest id>
        ├── <problem name>.cpp
    ├── <problem name>
            ├── main.cpp
ayham-1 commented 1 year ago

For template functionality, see #26.

And for default directory, I am currently working on that, see #27.

xeluxee commented 1 year ago

I was fetching a problem and wanted to exit the directory prompt by pressing Esc but it didn't work.

<esc> is used to switch to normal mode. If you want to cancel fetching just press <C-c>.

We need more configuration to the custom directory for each online judge, I used to add problems in its own directory and inside its online judge directory. I saw some people also do this not only me.

@ayham-1 @MuhammadSawalhy what do you think about using special modifiers for contest directory?

contest_directory = "$(HOME)/path/to/contest/directory/$(JUDGE)/$(CONTEST)"

So users can customize directory structure to their likings.

ayham-1 commented 1 year ago

@xeluxee that is a good idea.

$(CONTEST) is already implemented in #29, using the competitive companion's group item.

Question is: how would $(JUDGE) be implemented?

xeluxee commented 1 year ago

Question is: how would $(JUDGE) be implemented?

As README states:

group: Used to group problems together, which can be useful for archiving purposes. Follows the format <judge> - <category>, where the hyphen is discarded if the category is empty.

We can parse this string to take judge name and contest name. If <category> is empty we can substitute $(CONTEST) with a dummy string, like contest0, contest1...

MuhammadSawalhy commented 1 year ago

We can parse this string to take judge name and contest name. If <category> is empty we can substitute $(CONTEST) with a dummy string, like contest0, contest1...

It is so confusing as we have a variety of choices here. So, it is better to make the default configuration contest<counter:0,1,...> or to make a custom contest identifier per judge such as contest id for Codeforces.

In addition to that we need to make the custom contest directory configuration a function that takes all these arguments (judge and contest information) and returns a string so the user can have whatever he wants.

We also need to have a custom function to configure the custom directory/name for problems.

xeluxee commented 1 year ago

In addition to that we need to make the custom contest directory configuration a function that takes all these arguments (judge and contest information) and returns a string so the user can have whatever he wants.

We also need to have a custom function to configure the custom directory/name for problems.

Why do you need such a level of customization? Please provide an example. I think modifiers like $(JUDGE) and $(CONTEST) are enough for most use-cases.

MuhammadSawalhy commented 1 year ago

Why do you need such a level of customization? Please provide an example. I think modifiers like $(JUDGE) and $(CONTEST) are enough for most use-cases.

All users have their own directory structure and almost each of them is different from the others. What will be the value of $(CONTEST)? Some may use the contest id and some may use the contest name.

I think it isn't that difficult to allow custom function configuration and let the user do whatever he wants.