Suggestion Auto Tab scripts in code tags.

Discussion in 'Feedback' started by Xikini, Jun 19, 2017.

  1. Xikini

    Xikini Titan Kingdoms

    Joined:
    Nov 17, 2010
    Messages:
    3,007
    Likes Received:
    1,537
    Best Answers:
    33
    Would it be difficult to auto-tab scripts placed in code tags?
    I think it would be useful, as I often find people posting 'tabbed with spacebar' & 'I have no idea how to tab', which basically makes the code unreadable, until you copy paste the 10-2000 lines of script, and manually tab it yourself, so you can even start looking at the code.

    TL : DR - Can scripts be auto-tabbed by the system, before it's posted to the boards?
     
  2. WibbenZ

    WibbenZ Support Team Support Team Premium User

    Joined:
    Oct 16, 2008
    Messages:
    5,179
    Likes Received:
    826
    Best Answers:
    88
    There are ways to "auto" tab scripts, but you saying "spaces" Xenforo seems to replace tabs with spaces (unlike VB that we used before)
    I can't find any plugins for Xenforo to auto tab scripts so someone would probbly have to write one for the forum.

    But then again ppl might tab things in a certain way to help you see the problem (ex adding an extra tab) while that program would remove that tab.
    If this was to be added there should be a check to see if the script is already tabbed.
     
  3. Xikini

    Xikini Titan Kingdoms

    Joined:
    Nov 17, 2010
    Messages:
    3,007
    Likes Received:
    1,537
    Best Answers:
    33
    I meant, people tab their scripts with space, then copy paste in here, and the system removes the spaces which basically makes a long wall of text. xD

    But yeah, fringe cases should have an exclusion check of some sort.

    But my complaint is looking at these two types of tabbing
    Lua - Exhaust (cooldown) on this spell
    talkaction !buytools Proplem with script

    Whether or not the tabbing error's are accidental or copy-paste errors..
    I feel that if a system auto-tabs the scripts to always follow 'proper tabbing', we will at the very least, always be looking at the same tabbing each time we happen upon a post with code tags.

    Functional harmony & chaos. xD
     
    WibbenZ likes this.
  4. Thexamx

    Thexamx worst coder

    Joined:
    Sep 7, 2015
    Messages:
    1,115
    Likes Received:
    255
    Best Answers:
    12
    Maybe we could somehow check the "tabs" in code tag and then refuse to add the script if its not tabbed.
     
  5. WibbenZ

    WibbenZ Support Team Support Team Premium User

    Joined:
    Oct 16, 2008
    Messages:
    5,179
    Likes Received:
    826
    Best Answers:
    88
    Well in that case I fully support this :p

    Seeing as ppl can't read read rules (even if you warn them 10000 times) I doubt they would understand to tab the scripts xD
     
  6. Don Daniello

    Don Daniello /root Staff Member Administrator

    Joined:
    Apr 11, 2008
    Messages:
    3,282
    Likes Received:
    537
    Best Answers:
    5
    Whether you use spaces or tabs is a matter of convention. All projects I work on actually use 4 spaces for indentation, never tabs. That seems to be a recent trend. That's because a space is always the same length and a tab differs in screen-size based on the "viewer".

    Also, I doubt we will ever get a truly powerful code highlighter that has all the features we use/need. I would prefer to add an ability to e.g. embed GitHub Gists. However, that has the problem of users editing/removing them if they are used in Downloads possibly including malicious code or rendering the threads obsolete. There is no perfect way I can think of to make it good at the moment. However, XenForo 2 should improve the code highlighter - I think it will not require a plugin.
     
  7. WibbenZ

    WibbenZ Support Team Support Team Premium User

    Joined:
    Oct 16, 2008
    Messages:
    5,179
    Likes Received:
    826
    Best Answers:
    88
    Well I think thats the reason why (I guess) most users prefer tabs - if they wanna see 2 spaces per tab they can do that, if they wanna see 5/6 they can do that.
    But the end game is that everyone can see it as they want without the next guy going crazy over the 2 spaces or w/e

    I might be way off but didn't the VB code tags provide tabs "as is"?
    Another thing is the "numberd lines" when you copy paste a code from a post to another one, you insted have to paste it into the serach bar or a notepad to get rid of that and in most cases re-tab the script after that.

    Hopefully XenForo 2 can help fix those issues tho :p
     
  8. Shyzoul

    Shyzoul Active Member

    Joined:
    Apr 13, 2009
    Messages:
    367
    Likes Received:
    134
    Best Answers:
    5
    you can literally indent a whole file with 2 key strokes with vim.
    on topic, i always use space as Don Daniello said, tabs have not fixed size and bothers a lot when you use multiple editors.
     
  9. WibbenZ

    WibbenZ Support Team Support Team Premium User

    Joined:
    Oct 16, 2008
    Messages:
    5,179
    Likes Received:
    826
    Best Answers:
    88
    Not sure what you ment about the tabs, it's a single character like one space but you can edit the lenght of it in your editor, so the reason why it might look weird to you in another editor is because it uses another setting then what you are used with.

    In notepad++ you go to settings -> settings -> tab settings
    And in there you can change the lenght of the tab aswell as changing it for certain languages, ex if you want PHP to show 2 spaces per tab and C++ 10 spaces you can do that.
     
  10. Shyzoul

    Shyzoul Active Member

    Joined:
    Apr 13, 2009
    Messages:
    367
    Likes Received:
    134
    Best Answers:
    5
    i do only use terminal-like text editors, yes you can change the tab size, but when you need to do that let's say in 100 machines it will be really annoying (and stupid, since you could have used tab are spaces thing), another thing is that you don't always have root access to change/install things, as i said spaces are portable, tabs are not.
     
  11. WibbenZ

    WibbenZ Support Team Support Team Premium User

    Joined:
    Oct 16, 2008
    Messages:
    5,179
    Likes Received:
    826
    Best Answers:
    88
    Do you code on 100 machines?
    Let's say you prefer tabs, then you have to either replace the 2 or w/e spaces with w/e you prefer insted of always seeing it like you wish.

    Well tabs are kinda spaces but kinda not, they are a character just like the letter A that you can change the font size on, insted of always having it at the smallest or largest font.
     
  12. Xikini

    Xikini Titan Kingdoms

    Joined:
    Nov 17, 2010
    Messages:
    3,007
    Likes Received:
    1,537
    Best Answers:
    33
    To be clear, this thread isn't about the space key or the tab key, it's about proper identation of scripts inside code tags. :p

    Whether you want to use 4 spaces or 1 tab doesn't matter.
    I just want to be able to read the code. lol
     
    WibbenZ and Don Daniello like this.
  13. Shyzoul

    Shyzoul Active Member

    Joined:
    Apr 13, 2009
    Messages:
    367
    Likes Received:
    134
    Best Answers:
    5
    sorry about that :oops:, i believe if forum will auto indent thinks that might matter, and for now, i believe any editor can auto indent a file, you don't need to do it manually
    ofc i don't do programming on 100 different machines, if you ever have had any contact with unix-like systems you might noticed that all configurations is done through files, and much more, system automation with bash scripts, daemons, grub scripts, and so on, so you don't use text editors only for programming, about programming itself, it's not every company that gives you a exclusive machine, most of time you're jumping around, so thats why i keep with spaces, and all projects i've worked on, uses spaces either
     

Share This Page

Loading...