competitest.nvim icon indicating copy to clipboard operation
competitest.nvim copied to clipboard

Adding many features

Open nullchilly opened this issue 2 years ago • 17 comments

Thought I would let you know if you are working on something similar and your thought on this.

Split mode

image

Will consist of 6 windows: complication error, stdin, stderr, stdout, answer. Will be fully customizable. Personally I don't need complication error tab because there is already lsp

E.x. {"set nosplitright | vs | setl wfw | wincmd w | bel sp | vs | vs | 1wincmd w", {1, 2, 3, 4, 5}}

See: https://github.com/xeluxee/competitest.nvim/pull/8

Intergrate tabline with bufferline's custom section. Or maybe using winbar instead. Or perhaps something similar to incline.nvim? For now I will stick with custom tabpage :)

Get the most out of companion

Use regrex to parse problem name, let user determine the path to it.

E.x.

"https://codeforces.com/contest/(%d+)/problem/(%d)" -> vim.loop.os_homedir() .. "/code/contest/codeforces/$1/$2"
{"https://atcoder.jp/contests/(%s+)/tasks/(%s+)" -> vim.loop.os_homedir() .. "/code/contest/atcoder/$1/$2"

Keybinds

Add keybind tips: quick test case managing, for example:

  • 2t switch to test 2
  • hide current test, hide all test, hide AC tests, hide WA test

Auto parsing

Always listen to companion port since we are parsing new problem instead of just to the current file

Adding user custom output and local problem

g++ sol.cpp < 1.in > 2.out 2> 2.err This will also support for problems that requires reading from a file Adding local problem support also helps

Change C++ flags on the fly

g++ -Wall -O3
g++ -g -O2

Maybe compile_commands will helps?

Saving

Option to remember state of the current file, like submission history, local flags, test cases status

neovim style commands

:Competitest run 1
:Competitest submit

It makes auto complete much easier

See https://github.com/xeluxee/competitest.nvim/pull/7

Debugging

Debugging is very essential, we need to integrate with E.x nvim-dap

Stress Testing

Also very essential, I will go with codeforces's library See https://github.com/xeluxee/competitest.nvim/pull/9

nullchilly avatar Jun 12 '22 17:06 nullchilly

Hi @nullchilly, thanks for your suggestions. Unfortunately I can't start working on these features immediately, I'll start improving CompetiTest in some weeks.

Split mode

Already planned.

Get the most out of companion

Would you like competitest to clone an entire contest or problem? Related #5

Auto parsing - Always listen to companion port since we are parsing new problem instead of just to the current file

What's the issue? You can launch :CompetiTestReceive multiple times with multiple files

Adding user custom output and local problem

I can't get your point.

  • What do you mean with local problem?
  • Aren't testcases (with input and output) enough?
  • Do you want to save output on a file?

Change C++ flags on the fly

Actually you can do it: :lua require('competitest').setup { compile_command = { cpp = { args = {"$(FNAME)", "-o", "$(FNOEXT)"}}}}. This isn't so straightforward, but you can make a custom command to do that. Also compile_commands.json is generated by CMake, why one should use CMake for a competitive programming task? Maybe a local configuration (.competitest.lua) fits better for you. See https://github.com/xeluxee/competitest.nvim#local-configuration

Saving

Saving only for current session or after quitting Neovim?

neovim style commands

Looks good, I'll think about it

Debugging

What do you mean exactly? Isn't nvim-dap enough? Maybe you'd like to debug a solution with a specific input among the available ones?

Stress Testing

What is stress testing?

xeluxee avatar Jun 13 '22 19:06 xeluxee

I am on phone so I will leave a quick reply

I initially wanted to continue update my own plugin since June 2021 and I finally got the time to do it! It contains a lot of opinionated opt but I think it would be better if I can work with someone more familiar with lua to follow good practice

Local problems needs input file like freopen("r", "input.txt"). As you might notice there is also IOI format, OI format not just regular standard IO

About debugging yes you take input then debug directly, you also have to use a different flags just for debugging since it takes longer to compile ~~It is also better to just use compile_commands since a lot of neovim user also use lsp and are more familiar with it.~~ I guess you are right about this part

Stress test is when you randomly generate some test that works for brute forces solution but doesnt for your current code so you can actually debug them. See: https://codeforces.com/blog/entry/102287 for example Personally I will use https://github.com/MikeMirzayanov/testlib as a generator code

Or I can just provide a hook so user can do whatever they want using api? You also need to support stresstest for interactive too which is slightly hard.

Unfortunately I can't start working on these features immediately My intention isn't to ask you to implement all of these but I will do it. If you implemented split I would appreciate if you push them to dev branch so I can see what I can do, realistically it has been months and there hasn't been any development knowingly you are busy.

You will see all of these features in my fork since I am coming back to cp this summer. If it doesn't disappoint you I will start pull requests :)

nullchilly avatar Jun 13 '22 20:06 nullchilly

@xeluxee Better late than never

After spending an entire day editing the source I found myself wanting to change everything in this project

For example: I don't need singlefile testcases, I don't need a floating window that covers the code. I want to have per tab config not per buffer. I want output file for checker support. I want to limit input size. Adding split support requires too much refactoring so on and so forth. The times that I spend will be much, much more.

tl;dr I have decided to continue developing my old plugin (I will credit you of course ;) Definitely add these features back if you want. Or stay on the lightweight side 🤔

nullchilly avatar Jun 14 '22 16:06 nullchilly

I'm sorry you could not contribute to this project. I've started CompetiTest mainly to meet my needs during cp contests, but I'm also interested in hearing other users' needs in order to make this plugin better. The features you've proposed look good, probably I'll implement them in the (near) future. Anyway good luck with your plugin Leaving this issue open since other users may like to give suggestions about the mentioned features

xeluxee avatar Jun 15 '22 15:06 xeluxee

Hey. I love this project man. Just wanted to know if there is any thing we can do to use just one file. May be JSON or Something for storage. Making 2 files for each test case seems overkill.

Tsuzat avatar Jul 08 '22 12:07 Tsuzat

Hey. I love this project man. Just wanted to know if there is any thing we can do to use just one file. May be JSON or Something for storage. Making 2 files for each test case seems overkill.

https://github.com/xeluxee/competitest.nvim#storing-testcases-in-a-single-file

xeluxee avatar Jul 08 '22 12:07 xeluxee

Just looked into doc and found it. By the way thanks for quick reply. So another question is can we make it transparent? I mean the floating window that shows the test cases and all. Can we remove background from it?

Tsuzat avatar Jul 08 '22 12:07 Tsuzat

So another question is can we make it transparent? I mean the floating window that shows the test cases and all. Can we remove background from it?

At the moment it isn't possible, but I'll add an option to customize window highlights

xeluxee avatar Jul 08 '22 13:07 xeluxee

So another question is can we make it transparent? I mean the floating window that shows the test cases and all. Can we remove background from it?

At the moment it isn't possible, but I'll add an option to customize window highlights

Thanks for your time.

Tsuzat avatar Jul 08 '22 13:07 Tsuzat

Got it working. Had to do some research and turns out it uses NormalFloat

hi NormalFloat ctermbg=BLACK ctermfg=NONE guibg=NONE guifg=NONE

Screenshot_6

Tsuzat avatar Jul 08 '22 14:07 Tsuzat

@Tsuzat Maybe you can add a transparent option so you can actually see the code underneath?

https://twitter.com/neovim/status/1145446583573594112

nullchilly avatar Jul 09 '22 03:07 nullchilly

Split mode has just been implemented in c86a94c5bd2a1edb69d2f77616005423a65949e0 Also take a look at customizable layouts (idea taken from @nullchilly's cpeditor.nvim)

xeluxee avatar Aug 09 '22 21:08 xeluxee

Now you can download problems and contests with competitive-companion See https://github.com/xeluxee/competitest.nvim#receive-testcases-problems-and-contests

xeluxee avatar Jan 26 '23 18:01 xeluxee

Get the most out of companion

Use regrex to parse problem name, let user determine the path to it.

E.x.

"https://codeforces.com/contest/(%d+)/problem/(%d)" -> vim.loop.os_homedir() .. "/code/contest/codeforces/$1/$2"
{"https://atcoder.jp/contests/(%s+)/tasks/(%s+)" -> vim.loop.os_homedir() .. "/code/contest/atcoder/$1/$2"

See how to customize folder structure for received problems and contests.

xeluxee avatar Jul 19 '23 08:07 xeluxee

neovim style commands

:Competitest run 1
:Competitest submit

It makes auto complete much easier

See #7

Breaking change: Neovim-style single command has just been introduced with 254a81b

xeluxee avatar Jul 26 '23 15:07 xeluxee

Maybe compile_commands will helps?

Also compile_commands.json is generated by CMake, why one should use CMake for a competitive programming task?

@xeluxee I think he means the use of compile_flags.txt which clangd searches for to provide the configuration.

KorigamiK avatar Jul 26 '23 21:07 KorigamiK

@KorigamiK if you want to change compile commands you can create a file called .competitest.lua (see local configuration) and configure compile and run commands with it.

Maybe compile_commands will helps?

Also compile_commands.json is generated by CMake, why one should use CMake for a competitive programming task?

@xeluxee I think he means the use of compile_flags.txt which clangd searches for to provide the configuration.

Currently there's no plan to support language-specific configuration files, local configuration should be enough.

xeluxee avatar Jul 28 '23 16:07 xeluxee