canine's blog

By canine, history, 3 months ago, In English

hello all -- if you happen to be in the market for a new competitive programming extension and use VSCode, may i humbly suggest my new extension? i think it is relatively feature complete, but it's still in alpha (especially for languages other than C++) and may have some kinks that need working out. it theoretically supports C++, Java, Python, and Rust (and it's very easy to add more).

i created this because i was dissatisfied that most existing solutions can't import a bunch of test cases from a directory then run them in parallel. i also believe it has a cooler UI than other extensions. as usual, i didn't think it would take this long when i started...

if you encounter any difficulties, please let me know on github. thanks for taking a look!

hero image

Realtime Input/Output

unlike other test runners for VSCode, we let you use prewritten inputs and still interact with your program on the fly.

Input and Output Handling

Test Editor

extensive configuration and support for interactors and custom checkers (floating point is easy -- just use fcmp! thanks testlib).

Interactive Test

Stress Testing

run stress tests using a generator and brute force solution against your efficient solution. testlib is automatically included in generators/checkers/interactors.

Stress Testing

Debugging

debug with CodeLLDB / debugpy / the Java extension for VSCode. integrates with clangd to provide linting based on your compiler arguments.

Competitive Companion Integration

integrates with the Competitive Companion browser extension for one-click test imports.

note: you can't use Hightail's Competitive Companion integration while this extension is active (they bind to the same port).

File I/O and Directory Import

perfect for USACO!

website / visual studio marketplace / github

  • Vote: I like it
  • +177
  • Vote: I do not like it

»
3 months ago, # |
  Vote: I like it +49 Vote: I do not like it

Please try it out, he didn't sleep for the last few weeks (also it has cool features and UI).

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

w extension

»
3 months ago, # |
  Vote: I like it +32 Vote: I do not like it

This extension gained me +300 elo, 4.0 gpa, and night vision

»
3 months ago, # |
  Vote: I like it +8 Vote: I do not like it

What VS code version does it need? I am in version 1.82.3 and it tells me the extension can not be installed with this version. Should i download a new vs code ?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    yes, the minimum vscode version is currently 1.91.1 !

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      Thanks, i have successfully installed it. But there are some questions:

      • Does it have a light mode? Personally I can't stand dark mode :)
      • How to fill the settings? I cannot use it compile my code :)
      • »
        »
        »
        »
        3 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        sorry, currently no light mode but i'll add that to the TODO! shouldn't be hard at all

        to fill out settings for the current workspace, you can open test editor, click on "select language," choose your language and the compiler & compile arguments fields should appear

        if you want to modify global settings (for all workspaces), for now you can edit those in the vscode settings UI, which you can access through test editor -> settings button with gear. you probably want to change "cpu: compiler," which should be a table with languages on the left and compiler on the right (blank is default)

        • »
          »
          »
          »
          »
          3 months ago, # ^ |
            Vote: I like it +16 Vote: I do not like it

          I think i have completed the settings now, but it just tells me that Error compiling a.cpp: Failed to compile a.cpp :)

          • »
            »
            »
            »
            »
            »
            3 months ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            hey! i've added light mode and i think it works with MSYS2/minGW now. debugging on windows is unfortunately pretty terrible because I couldn't get CodeLLDB to work

            • »
              »
              »
              »
              »
              »
              »
              3 months ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              Wow it works! Nice work!

              There are still some small issues:

              • In light mode, when you select a line, the selected color is the same as the background.
              • Can I interactive manally without the interactor? I dont really know how to set this :)
              • »
                »
                »
                »
                »
                »
                »
                »
                3 months ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                fixed the editor selection background in light theme in v0.2.3!

                to interact manually, use the test i/o tab, which should be a panel at the bottom (alongside the terminal, output, etc).

                it should automatically open up when you run/debug a single test case (but not during run all or stress tests)

        • »
          »
          »
          »
          »
          3 months ago, # ^ |
            Vote: I like it +8 Vote: I do not like it

          Facing a compilation error. Is it for minGW??

          • »
            »
            »
            »
            »
            »
            3 months ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            this should have a ∞ better chance of working if you update (im dumb bc apparently windows has the very strange behavior of using .exe for executables...)

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

interesting

»
3 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Can you elaborate on how you do stress testing? I understand the brute is just a slower brute solution which you can make pretty easily, but how do you create the generator?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    #include <bits/stdc++.h> using namespace std; int gen_int(int l, int r) { random_device rd; // Seed generator mt19937 gen(rd()); // Standard mersenne_twister_engine seeded with rd() uniform_int_distribution<> dis(l, r); // Distribution in range [l, r] return dis(gen); } int rand(int a, int b) { return gen_int(a , b ); } double getRandomDouble(double l, double r) { random_device rd; mt19937 gen(rd()); uniform_real_distribution<> dis(l, r); // Distribution in range [l, r] for double return dis(gen); } string generateRandomString(int length) { //const string charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; const string charset = "01"; string result; result.reserve(length); for (int i = 0; i < length; ++i) { result += charset[rand( 0 , charset.size() -1 )]; } return result; } vector<int> getRandomPermutation(int n) { vector<int> perm(n); for (int i = 0; i < n; ++i) { perm[i] = i + 1; } random_device rd; mt19937 gen(rd()); shuffle(perm.begin(), perm.end(), gen); return perm; } int main() { // random_shuffle(perm.begin() + 1, perm.end()); // create vector kima yji ! int n = rand (0 , 500 ) ; cout << n << endl ; return 0; }
  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    the generator should simply output a test case given an argument as a seed (or it can ignore the argument and use another source of randomness). you can customize the arguments supplied in the test editor

    i recommend using testlib (just #include <testlib.h> should work) because it's designed for this -- you can see examples at https://github.com/MikeMirzayanov/testlib/tree/9ecb11126c16caeda2ba375e0084b3ddd03d4ace/generators

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

how to configure the interactor ?

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

This is mainly for mac for now?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    kind of. it has been lightly tested on linux and once on WSL. if you find any issues with other platforms just create a github issue!

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Looking good. Will give it a try.

»
3 months ago, # |
Rev. 2   Vote: I like it +8 Vote: I do not like it

how to use the interactor? Loved it and installed on the first go! Awesome work!

Also for some reason I'm getting a compilation error. Here's what the extension is executing

C:\msys64\ucrt64\bin\g++.exe c:\Users\wasif\OneDrive\Desktop\code\code3.cpp -o c:\Users\wasif\AppData\Roaming\Code\User\workspaceStorage\c888f75f52f90b732349f7f8b057f4f2\thomasqm.cpu\build\e75c1b6b8b2f450230a7834d7d4ec8e0 -Wall -std=c++20 -g -O2 

I used coderunner before and it used this

cd "c:\Users\wasif\OneDrive\Desktop\code\" && g++ code3.cpp -o code3 && "c:\Users\wasif\OneDrive\Desktop\code\"code3
»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I really enjoyed using your extension, but I primarily use CLion IDE developed by JetBrains. Could you please create the same extension for CLion as well? I really need this.

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I second this idea :)

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Here's a plugin that's built for CLion: AutoCP.

    • »
      »
      »
      3 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Does it work for interactive problems? Cause it doesn't seem like it.

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Great work Btw,do you have a wolf?

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

can i use this with wsl ?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    yes, it should work with WSL! (i'll fix the issues with using MSYS soon™️)

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Does it have light mode?

»
3 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I tried stress testing, but its throwing the following error: Error compiling brute.cpp: Failed to compile brute.cpp (nonzero exit code)

Though the file is executing properly when I execute it. How to resolve this?

  • »
    »
    3 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    hmm, that's strange. do other tests work fine and the compiler does not give any errors?