Блог пользователя snapdragon3101

Автор snapdragon3101, 5 лет назад, По-английски

Check : https://cpeditor.github.io

Hi Guys !

You guys are truly amazing. I created CP Editor around 3 months ago just for fun and personal use, never wanted to make it public but anyways, I decided to make it public with this blog. I got so much love and support that I could not hold myself back from improving it, in following weeks I released the second version in this blog. Fixing a lot of issues and bringing new features.

Let's get into what is new in this release of CP Editor. But first,

Merry Christmas programmers!!

Thanks to ouuan for his wonderful contributions. Almost all new features were implemented by him.

What's New

More information
  • [NEW] Editor now only prompts to save on exit, if unmodified changes are present.
  • [NEW] Title-bar shows * for unsaved files.
  • [NEW] Verdict now shows colors. WA in Red and AC in Green.
  • You can Expand the size of the Input, Output and Message box.
  • Now you can Read Input from files in Input boxes.
  • Editor now also Optionally accepts Expected Output that you can use to check against your program's stdout.
  • Editor also Shows Verdict If you have provided Expected Output. Verdict can be any of three :
    • AC : Accepted, Verdict given when Output matches with Expected Output
    • WA : Wrong Answer, Verdict given when Output does not matches with Expected Output
    • ** : Unknown, Either Expected or Your Program's stdout is Empty.
  • Diff viewer has been added to check the difference between the Expected and Produced Output. (Click More to view Diff)
  • Set Tab Size.
  • Added Competitive Companion in the Editor. So no need to copy paste Input/Output manually, Competitive Companion fetches testcases for you. Set it up as follow :
Setting Competitive Companion

What's Fixed

  • [New] Fixed Issue when even if expected and produces output were same, the editor still produced WA.
  • [New] Fixed an Issue where upon format, there was a chance of command window to blink.
  • [New] Fixed Application Crash when Companion Server was restarted.
  • [New] Fixed Issue where AppImage would crash on Some Ubuntu 18.04.
  • Fixed the issue where { always automatically added a new line with }
  • Fixed Tab and Spaces mix-up, in the old version editor always used Spaces for indentation.
  • Fixed issue where if user was not opted for beta. Still they get beta update notifications.

Troubleshooting and General Information

  • Make sure Competitive companion extension port and CP Editor Companion port are same and above 10,000.
  • Make sure no other server is listening on the port. If this is the reason you may have to change the port to something else that is not being used.
  • Two instances of CP Editor will not be able to run Companion, because only one of them can listen at one port.
  • Competitive Companion can also parse Contests. Make sure you are on a problem page when you press parse Task not on a contest page.
  • If a problem has more than Sample 3 testcases. The Editor will discard all testcases except first three.
  • I have not much experience with Windows, So if your OS has a firewall that prevents CP Editor from listening or request from arriving, you may need to add an exception for the port in your Anti-virus or firewall settings.

Download

Sources : https://github.com/coder3101/cp-editor2

Download : https://github.com/coder3101/cp-editor2/releases

Support me with Stars**
  • Проголосовать: нравится
  • +123
  • Проголосовать: не нравится

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How can I use it in my Ubuntu ?

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

"An invalid payload was delivered on the listening port"

The above error is coming when we click on the browser extension on codeforces.What to do now, i have checked they have same port no configured.

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    That message pops if the extension is not providing correct json data. Try another browser even try changing ports.

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Thanks, one feature that we can't resize the coding area and hence its not helping to work properly on split screen. Any help to enable the feature to reduce coding area(i tried the normal way,it did't work). Thanks again.

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      I've tried changing ports and still get the same message. Is it possible to fix this issue without trying another browser? I don't have other browsers available (except Tor).

      • »
        »
        »
        »
        5 лет назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        Check with Competitive Companion, GitHub page, (url in post) i guess it doesn't work well with tor. Try opening an issue there and see if there is a fix! Since this issue is not related with Editor, I cannot help much except to guide you to correct place.

        • »
          »
          »
          »
          »
          5 лет назад, # ^ |
            Проголосовать: нравится 0 Проголосовать: не нравится

          Sorry, I use Google Chrome as my main browser. I'm just stating that I don't have any browsers other than Google Chrome left, except Tor.

          Apologize for the unclear information.

          • »
            »
            »
            »
            »
            »
            5 лет назад, # ^ |
              Проголосовать: нравится 0 Проголосовать: не нравится

            So you are getting error? What does it says?

            • »
              »
              »
              »
              »
              »
              »
              5 лет назад, # ^ |
                Проголосовать: нравится 0 Проголосовать: не нравится

              My browser is Google Chrome. This message appeared on the editor as I click the parse button of the extension:

              "An invalid payload was delivered on the listening port"

              I tried changing port to some values larger than 10000 and it still doesn't work.

»
5 лет назад, # |
Rev. 3   Проголосовать: нравится +5 Проголосовать: не нравится

Hey)

Recently I've started to use this editor, and I like it very much so far) Here some of my thoughts)

1) The size of output boxes and compiler messages box size could be flexible, because on small monitors there is just not enough space for code editor window.

2) An option to make a new .cpp file after parsing a task could be very convenient. Like it would be possible to choose a folder, and when I parse a task, a file with the task name automatically is made.

3) I cannot figure out why the expected output thing sometimes does not work. It works for sums of numbers for example. But for this task https://codeforces.me/contest/1277/problem/B it does not work for some reason. It prints WA when the output is clearly the same.

4) Make run and compile possible using a hotkey

5) Make an option to make WA and AC red and green colors, so I'll will be able to immediately see the verdict

Keep up the good work, I'll definitely follow this project)

EDIT: here an img of bug that I mentioned in (3) https://imgur.com/a/7Q6miXw

  • »
    »
    5 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится +5 Проголосовать: не нравится

    Thanks to ouuan, points 5, and points 3 are fixed and will rollout as update in following days.

    EDIT: You should open this as issues in GitHub, so that you can track it's status and it also reminds us what to do.

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    Yes, i know it is issue with carriage return and line feeds. It has been fixed, in coming days you will get an update!

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is there any way to update instead of download new version and install it?

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Windows??

    It's 15 MB .exe file, download it and run it will update if you already had it installed otherwise it will install.

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    The method of update you are asking is called delta updates. Not even VSCode or Atom have it. To update your editor you need to download full size new binaries.

    Those features usually come in handy with professional IDE like Jetbrains, they have modular structure and hence such updates are possible.

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

I have been using this text editor and its really cool.I just wanted to share a few things i have experienced multiple times-

1) There's some issue when we use mouse to select a range of code,and try to copy or do something,i mean, there's no problem in copying but i was not able to select the lines of code as normally as we could have done.There's some issue there.

2)There were problems that i was solving, that got executed in other online compilers and also got AC in codeforces but I was getting error in the text editor( and i was just finding whats wrong in my code when there was none). The error message i was getting is "Error occured during execution...Non-zero exit code -1073741571" Here is one of the submissions if you want to refer it: 67448850. You may try it for any test case.

3) When we press '(' followed by ')' key, we get only one pair of bracket but this doesn't happen in case of the following keys- ',"(single inverted and double inverted) where we get two pairs if we press twice.Please make it behave the same as bracket.

But altogether a great experience, and thanks for this editor.

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +8 Проголосовать: не нравится

    67448850 works well for me (on Windows 10). Could you please provide your environment?

    BTW, it's better to open an issue here for 2). But for 1) and 3), they are editor issues, so you should open issues here.

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      I am also using windows 10.Any idea why its happening like that?

      • »
        »
        »
        »
        5 лет назад, # ^ |
          Проголосовать: нравится +9 Проголосовать: не нравится

        Which version of CP Editor are you using? What's your compile command?

        • »
          »
          »
          »
          »
          5 лет назад, # ^ |
            Проголосовать: нравится 0 Проголосовать: не нравится

          The version is 3.0.0 The command is g++ -Wall

          • »
            »
            »
            »
            »
            »
            5 лет назад, # ^ |
              Проголосовать: нравится +9 Проголосовать: не нравится

            Try adding -Wl,--stack=536870912 to the compile command. You declared arrays in the main function, which cost the stack memory. You should declare them outside the main function, or add -Wl,--stack=536870912 to get more stack memory.

          • »
            »
            »
            »
            »
            »
            5 лет назад, # ^ |
              Проголосовать: нравится +9 Проголосовать: не нравится

            And you should update the editor. There are many cool features in the newest version.

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    Error occured during execution...Non-zero exit code -1073741571

    Such behavior is a cause of memory error! If your programs runs out of stack or heap memory on your machine. It abruptly halts with non-zero exit code. Codeforces judges are powerful and have enough memory, so it runs fine there.

    Also, --stack will only work on windows. Also, better safe than sorry, if your can give some more time to compilation, you could use sanitizers, by appending -fsanitizer=memory,undefined. It prints to stderr, the complete state of memory if anything bad happens. It does slows compilation but not much, there are more sanitizer like address, but only in clang. So I recommend using and installing llvm clang for windows. You will get formatter and complete compiler!

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Does this work on Macintosh??snapdragon3101

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

So i have been using this editor for the whole day today, and i'm totally in love with this.

I was really in need of something like this :P

I would like to request/recommend some more features which will surely enhance this awesome editor.

  1. Support for more themes ( I really like my Monokai Theme :P ).
  2. Feature that lets you comment a block of code using [ Ctrl ]+[ / ]
  3. Auto Completion
  4. Some more blocks for test cases, maybe scrollable (Not a Must tho)

Thanks to snapdragon3101 and all devs for creating this. <3

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    Support for more themes! Okay, It can be added easily.

    Comment with CTRL+/ is already in progress.

    Auto completion requires at least some kind of LSP which slows down stuff! However auto completion like that of Geany could be added. It's already in progress, actually I am stuck at one of dependency to add this feature. So as soon as it's done, it will rollout!

    I thought 3 would be enough as mostly CF problem or other problems don't have more than 3 testcases. It also requires doing some UI tweaks which i don't want to do now. Maybe Later.

    Here is what you should do:

    Open issue on the above GitHub, that way you can track the progress of your feature requests! Open 2 issues one for CTRL+/ comment and other for Monkai theme. Issues also help us (devs) to remember what our users want.

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is there a way to make snippets?

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

[Format feature will not work as your format command is not valid]. I am getting this error. Please help.

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Just ignore it. If you don't want code formatting to eork!. To solve it you need to download and add to path clang-format

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      How do I add it? I am new to this. Can you please help.

      • »
        »
        »
        »
        5 лет назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        I am not very familiar with Windows system but it's called Environment Variable. You need to add the path of LLVM to ENVIRONMENT Variable named PATH. But as I said earlier you can ignore this error and everything should work fine. Except of course Code Formatting