Search Unity

Kill ICODE please.

Discussion in 'Meta-forum Discussion' started by BlackPete, Mar 8, 2018.

  1. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    It's great that there's finally a more visible button to post code snippets. Having it inside Insert... is just too well hidden for most users.

    However, why can't it use the CODE tag instead of ICODE?

    Maybe it's just me, but ICODE actually makes code less readable because long lines just get cut off.

    Example from this thread: https://forum.unity.com/threads/ijob-not-changing-an-integer-when-it-runs.520507/

    upload_2018-3-8_14-4-11.png
     
  2. and-poulsen

    and-poulsen

    Unity Technologies

    Joined:
    Sep 30, 2016
    Posts:
    66
    Looks like it got deployed to live unintentionally - it's an unfinished formatting feature. It's supposed to be for just inline code, like mentioning a variable mid sentence.
    For big code blocks, you'd still use the Insert->Code method
     
  3. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    Insert->Code is too hidden though. Before this new button came along, new users in the scripting forum didn't format code at all. Now new users in the scripting forum are using this ICODE formatting because they want to format, they just didn't know there's a better way to do it.
     
  4. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,038
    This has yet to happen. People keep using ICODE, and the forum is worse off as a result.
     
  5. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    Could you please, please take it out until it's ready? Right now all new users press it as it's easier to find, so we get garbage like this, where a bunch of the poor sod's code has been cropped out.

    Making people post code properly is already hard enough, and you just made it harder. "Please use code tags. No, not the code tags that are easy to find, the other ones".
     
    chingwa likes this.
  6. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,038
    Why don't they simply remove one letter from the tag inserted by that button? That would solve everything with basically no effort.

    The real solution is of course to make the four functions under "Insert…" actual buttons on the bar, and instead put alignment options under a foldout menu to make the bar less busy. The code button should also have some qualifier to imply it's the one you want, like "Insert block of code".
     
    Martin_H and BlackPete like this.
  7. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    I confess that I'm actually browsing the scripting forum less often than I used to... I just got tired of seeing unreadable chunks of code posted, spend time telling them to add code tags, and now we also need to tell them they're using the wrong code tags?

    This is all a waste of time for all of us, so I browse less as a result. I don't think this is a good path for these forums to take.
     
  8. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,038
    Me too. I know I'm going to want to gouge my eyes out, so I barely skim the forums.
     
  9. and-poulsen

    and-poulsen

    Unity Technologies

    Joined:
    Sep 30, 2016
    Posts:
    66
    I see, I'll sort it out.
     
    orb likes this.
  10. and-poulsen

    and-poulsen

    Unity Technologies

    Joined:
    Sep 30, 2016
    Posts:
    66
    Alright, how's this - exposed the Insert Code button on the toolbar, and formatted the
    inline code tag
    . I'll see if I can clean up a few of the misused inline code tags.
     
    orb likes this.
  11. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,038
    Almost perfect - if inline code could be part of a sentence rather than having a line break before and after, it would even be useful :)
     
  12. and-poulsen

    and-poulsen

    Unity Technologies

    Joined:
    Sep 30, 2016
    Posts:
    66
    @orb , it should be, if not - it's just because your css is cached, will clear itself out soon
     
  13. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,038
    Did the monthly cache-clean and restarted the browser, but no difference.
     
  14. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,537
    Finally
    at last we have inline
    code tags.

    Hopefully people don't do
    Things like this.

    Seems pretty clear that there are different buttons, though.


    Test

    var x = GameObject.Find("pants");
     
    Martin_H and Baste like this.
  15. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,038
    Now inline stuff is showing up on the same line like it should.

    If this doesn't help against new users picking the wrong type, make the primary code button 50% larger or otherwise more visible :)
     
  16. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    Whoa... this might be
    useful!


    Code (CSharp):
    1. void Yay()
    2. {
    3.    Debug.Log("Yay!");
    4. }
    I never new the full form of CODE was CODESHORTCUT. :D

    EDIT: Actually, it looks like the code shortcut button doesn't work. Trying again with just CODE (typed manually) instead CODESHORTCUT (as inserted by the button):

    Code (csharp):
    1.  
    2. void Yay()
    3. {
    4.    Debug.Log("Yay!");
    5. }
    6.  
    EDIT2: Yep, typing CODE manually still works. Can the button be fixed to just code?
     
    Last edited by a moderator: Mar 28, 2018
  17. and-poulsen

    and-poulsen

    Unity Technologies

    Joined:
    Sep 30, 2016
    Posts:
    66
    @BlackPete - it should be more consistent, and work for more browsers now
     
    BlackPete likes this.
  18. razamgar

    razamgar

    Joined:
    Apr 7, 2020
    Posts:
    14
    I have manually specified Courier font instead of
    ICODE
    because I thought it would look unsightly as when previewing (and as in the OP) - newline before and after it, no nice gray background and padding. Turns out it actually is the pretty inline code stuff you all use. Could you ensure CSS in preview matches what you get when posted @and-poulsen? Pretty please?

    While we're at that, it'd be really neat if user mentions weren't parsed within
    ICODE
    tags. For example, this happens when I try to type "at sign import" within it:
    [USER=618357]@IMpoRt[/USER]
     
    Last edited: May 18, 2023
  19. checkshipment

    checkshipment

    Joined:
    Jul 3, 2023
    Posts:
    1
    However, the "Insert->Code" option is quite hidden. Prior to the introduction of this new button, new users on the scripting forum did not format their code at all. Now, new users on the scripting forum are utilizing the ICODE formatting because they desire to format their code; they simply weren't aware that there was a better method available.