-13

It seems that the code editor could be some much better and that almost any other site for code has a better code editor than SO. We have 5*10 centimeter to go into uttermost detail and editing and marking the code is not painless when the area is so small and not resizable. Is it a good decision that SO doesn't improve the code editor?

Concrete ways to make it better:

  1. The undo function is broken when using http form to submit code. Trying to undo can be a disaster. It is better to not be able to undo than to cause a disaster and clear everything you wrote and irreversible.

1½ I can't even paste code without having to scroll up to mark it as code. Isn't there three ways so that I can paste without going up to the beginning?

  1. The area to write is way too small. Increase it and make it more like a "web IDE", ideally runnable code.

  2. The markup syntax is not logical. It is easier to learn syntax that is also intuitive e g [link:google.com, text:Google]

  3. It's difficult to update code and it gets undone if you update code in an old question. Ideally the code we work on should be versioned so that I can enter code here and update it and simplify stackoverflow for actual work on code instead of just telling me, which works but it is better to make code than tell people how to code.

  4. Maybe the code should be completely separate from the question. I like pastebin.com and there are many such good code editor.

  5. Marking and editing code often fails. Try it yourself how to fix this simple unreadable code that is too far to the right only because I copy it from an indented part. I have marked this code as "code" and still it breaks halfway from the bottom.

    if (keep) { *pString1 = concat(concat(*pString1, (ptr + j)), " "); / recursion */ p++; } else { b1 = false; int q = j; for (e = 0; (ptr + q + e); e++) { / step through the string / b1 = true; if ((ptr + e + q)) { *pString = concat(concat(*pString, (ptr + e + q)), " "); / recursion */ } j = e; } if (makeArgs(*pString, &argc, (const char ***) &argv, pipe, i, h)) { write_command(&w, argv, string[w]); w++;

                                } else {
                                    if (!b1) { /* no args (?) */
                                        for (int r = 0; argv[r] != NULL; r++) {
                                            string[i][r] = argv[r]; /* is this necessary? */
                                        }
                                    }
                                }
                            }
    
7
  • 4
    Please edit your question and add specifics how the code editor isn't good enough.
    – user4151918
    Apr 29, 2016 at 6:32
  • Can you make it better? Can you suggest concrete ways to make it better? As is this is a rant about the SO code editor.
    – Magisch
    Apr 29, 2016 at 6:33
  • 17
    This has come up several times before. With the common conclusion that we never want SO users to write code in the post box. Since that is pretty much guaranteed to be code that was never tried and likely to suffer from very basic syntax errors that distract from the real problem. We need to see the code that you tried to make work. That comes from your favorite programming editor and verified by your compiler and tested with your debugger. At which point having an elaborate post editor is completely pointless, you simply copy/paste it. Apr 29, 2016 at 6:44
  • 1
    If you're talking about the snippet editor, please say so. As it is now, you'll only get responses based on misunderstanding.
    – Mr Lister
    Apr 29, 2016 at 7:21
  • 3
    What @HansPassant says. There are already far too many questions that strongly imply that some incorrect result was obtained from a test run, only for to be revealed later, (after several SO contributors have wasted their time on typos etc), that the source was just manually transcribed from printed homework and posted off to SO without any attempt at all to compile/build/test/debug. No help whatsoever should be given to assist in such abusive behavior. Apr 29, 2016 at 10:12
  • 1
    Markdown isn't my favourite syntax in the world, but it's become the most widely-used among programming sites everywhere. Programmers are more likely to be familiar with it than almost anything else you could reasonably pick.
    – Jeremy
    May 1, 2016 at 4:12
  • @MartinJames For C#, where stackoverflow seems prevalent, dotnetfiddle.com is helping with that. SO should start encouraging its use and directly integrate it or similar instead. With a moderation flag for "code doesnt compile"
    – enorl76
    Dec 22, 2018 at 4:08

1 Answer 1

17

It is assumed that you already have a code editor, and that:

  1. you've written your code in it
  2. you encountered a problem
  3. you researched your problem
  4. you reduced the code necessary to demonstrate your problem down to the minimum complete amount (perhaps in a new project).
  5. if all above steps fail, you copy & paste your code into your question; already nicely formatted and no editing needed.

(By the way, you can drag the editor window down to make it bigger. You can't make it wider, because we want to discourage people from having to scroll right to continue reading a line.)

4
  • 2
    You could say the same about GitHub, that you already have a code editor and thats what you use to submit code to GitHub, yet it's easier to work with code in GitHub, even in comments, than it is in Stack Overflow.
    – Ian Walter
    Sep 22, 2017 at 16:11
  • @IanWalter is correct. Github's code marking style of triple backtick is ten times better. It could be a very easy transition to that style... extra credit: triple backtick supports specifying the language the code is in for syntax highlighting. The code blocks in StackOverflow are looking a bit dated... lol
    – enorl76
    Dec 22, 2018 at 4:06
  • past all that - auto-indentation would be nice. A lot of questions can be answered with < 10 lines and would not have to be typed in a separate with a cumberome workflow, if it would at least preserve the indentation of the previous line.
    – jsbueno
    May 21, 2020 at 13:23
  • 1
    Also, the topic marked as 1½ in the question is not addressed: pasting code Could be made more confortable.
    – jsbueno
    May 21, 2020 at 13:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .