Home AMX User Forum NetLinx Studio

Code Formatting Issue?

Sorry if this has been addressed before, I wasn't exactly sure how to search, tried a few things and nothing came up.

The issue is this:

I do this:

dvVPROJ = 5001:1:0 // NEC NP3151W PROJECTOR
dvPLASMA1 = 5001:2:0 // NEC P42XC10 PLASMA
dvVGA_SW = 5001:3:0 // EXTRON MVX44 VGA A SWITCHER WITH AUDIO
dvCODEC = 5001:4:0 // TANDBERG 3000 MXP 9600,N,8,1
dvREL = 5001:8:0 // RELAY PORTS FOR SCREEN
dvDVD = 5001:9:0 // SONY BDPS300 BLURAY DVD PLAYER
dvTBERG_IR = 5001:10:0 // TANDBERG IR RECEIVER AT CAMERA

And when the file is opened by someone else or on another machine it ends up like this (not always but often enough):


dvVPROJ = 5001:1:0 // NEC NP3151W PROJECTOR
dvPLASMA1 = 5001:2:0 // NEC P42XC10 PLASMA
dvVGA_SW = 5001:3:0 // EXTRON MVX44 VGA A SWITCHER WITH AUDIO
dvCODEC = 5001:4:0 // TANDBERG 3000 MXP 9600,N,8,1
dvREL = 5001:8:0 // RELAY PORTS FOR SCREEN
dvDVD = 5001:9:0 // SONY BDPS300 BLURAY DVD PLAYER
dvTBERG_IR = 5001:10:0 // TANDBERG IR RECEIVER AT CAMERA



What gives??!! Im starting with a new company where Ill be working on the same project in tandem with another programmer and this issue is gonna kill me.

Thanks in advance!

Comments

  • Ok well the forum is not formatting the text from my post correctly (I think theres a way to do this where it is formatted properly and has a scroll bar? But i dont know how to do it.)

    Basically just picture if the first set of device definitions has the equal signs and device numbers all lined up nice and neat, and the second set of code would look all jacked up with the alignment all over the place.
  • jjamesjjames Posts: 2,908
    Not a bug or problem, but a difference in tab stops & space indents. Go to Settings, Preferences, Editor - Display and Indentations. Towards the bottom of the dialog are the settings that are different between the two machines.

    Code formatting on the forums is done by using the CODE tags. (Remove the spaces that I've inserted in the tags for it to work properly.
    [ CODE ]
    // Put stuff here
    [ /CODE ]
  • ericmedleyericmedley Posts: 4,177
    If you're using the space bar to line up things it only works if you have the exact same font on the subsequent computers. If you use Tabs to space over, it will work a little better but, here again, the fonts can goof it up too.
  • viningvining Posts: 4,368
    There's also the tab settings themselves. Some people use different setting and this is a user defined setting in the editor preferenceS, some use 3 spacectabs an others use five. I don't even know what i use any more but i know it's different from every one else cuz i like white space. Real programmers don't.
  • ericmedleyericmedley Posts: 4,177
    vining wrote: »
    There's also the tab settings themselves. Some people use different setting and this is a user defined setting in the editor preferenceS, some use 3 spacectabs an others use five. I don't even know what i use any more but i know it's different from every one else cuz i like white space. Real programmers don't.

    Mine is set to 4 space tabs. But I use a giant font size cause of mah room-a-tizm and old tired eyes.

    16 pt. Trebuchet.
  • DHawthorneDHawthorne Posts: 4,584
    vining wrote: »
    There's also the tab settings themselves. Some people use different setting and this is a user defined setting in the editor preferenceS, some use 3 spacectabs an others use five. I don't even know what i use any more but i know it's different from every one else cuz i like white space. Real programmers don't.

    That's kind of like saying, "real programers write in machine code, in binary." I like white space too, because in the pragmatic world, I have to be able to read it two years after I wrote it, and wall-of-unbroken-text doesn't pass as readable or parsable to my human eyes.

    That said, over indentation does drive me crazy. I could never see the point of having the code start halfway to the vertical center of the workspace ... though I have to confess, it's more likely a tab translation when I see that than someone doing it deliberately.
  • Preferences

    Those of you that share code might find it useful to document your Tab and Indentation Preferences settings in a comment section near the beginning of the source code file. I got in the habit of doing this many years ago.
    //
    // This source code is best best viewed with Tab and Indentation Preferences set to 3.
    // NetLinx Studio Menu Bar: Settings >> Preferences >> Editor - Display and Indentations
    //
    
  • B_Clements wrote: »
    Those of you that share code might find it useful to document your Tab and Indentation Preferences settings in a comment section near the beginning of the source code file. I got in the habit of doing this many years ago.
    //
    // This source code is best best viewed with Tab and Indentation Preferences set to 3.
    // NetLinx Studio Menu Bar: Settings >> Preferences >> Editor - Display and Indentations
    //
    


    Good suggestion.

    And thank you all for the help!
  • ericmedleyericmedley Posts: 4,177
    I do this same kind of thing...
    // this code was written by EJM
    // ...
    // (sorry)
    
    
  • jweatherjweather Posts: 320
    I auto-indent at 4, but tab stops are set to 8. For a while I was putting this at the top of my source files:
    Please set tab width 8 so that the vertical lines below match up:
    
    --------|-------|
    	|	|
    --------|-------|
    

    Obviously the middle line used tabs rather than spaces.
  • viningvining Posts: 4,368
    DHawthorne wrote: »
    That's kind of like saying, "real programers write in machine code, in binary." I like white space too, because in the pragmatic world, I have to be able to read it two years after I wrote it, and wall-of-unbroken-text doesn't pass as readable or parsable to my human eyes.
    Shows how much i know about real programmers. I was really just trying to imply that i wasn't one.

    I do 5 & 8. 5 just because that's what i learned was the standard indent in a typing class i took in high school. Who knew i'd be able to remember that tid bit of knowledge and also have a chance to use it some 30+ years later. Still can't type worth a damn though.
Sign In or Register to comment.