Shop OBEX P1 Docs P2 Docs Learn Events
Using tabs instead of spaces in the Propeller Tool — Parallax Forums

Using tabs instead of spaces in the Propeller Tool

Fake-NameFake-Name Posts: 7
edited 2009-06-07 14:33 in Propeller 1
I realise this is a bit of a religious topic among programmers, but I've recently been learning to work with the propeller MCUs, and the IDE is driving me nuts!

Please, Parallax, add an option to use tabs instead of spaces (and expanding tabs to spaces doesn't count). I realize it's a little thing, but it seems I'm constantly chasing errant spaces in my code. The propeller is an awesome product, and really easy to work with, however writing code for it is a bit of an ordeal.

Also, would it be possible to make \n characters wrap? The window full of spaces thing is a bit annoying too. It's really nice to be able to tap the right arrow key at the end of a line to jump back to the first column.

I realise these seem like fairly petty annoyances, bit the prop tool seems to be the only IDE I've ever worked with that treats spaces the way it does, and having to switch between it and ofther environments when working on other projects is really difficult.

Comments

  • jazzedjazzed Posts: 11,803
    edited 2009-06-07 07:41
    I think that if you use the Parallax font in your file you will end up with tabs. That's one of the reasons I avoid the font [noparse]:)[/noparse][noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Steve


    Propalyzer: Propeller PC Logic Analyzer
    http://forums.parallax.com/showthread.php?p=788230
  • Fake-NameFake-Name Posts: 7
    edited 2009-06-07 08:01
    jazzed said...
    I think that if you use the Parallax font in your file you will end up with tabs. That's one of the reasons I avoid the font [noparse]:)[/noparse][noparse]:)[/noparse]

    Uh... What? There isn't any option to change the font in the editor.

    Incidentally, I've found another good reason to fix the non-linewrapping behavior of the editor. I opened up a .spin file in an external editor, and it looks like the prop tool is appending spaces onto the right hand of many lines. It wouldn't suprise me if some source code file sizes are half again as large as the actual code content due to extraneous spaces.

    It seems if you're moving from one line to another, and click to the right of the line, and type anything, the Prop tool thinks you want all the spaces between whatever you typed and the beginning of the line. However, if you delete whatever you typed, the spaces persist. If you're working on a piece of code a lot, more and more lines begin sprouting invisible extensions.

    Now, a little additional file size shouldn't be a problem, but I personally use a SVN server to track my projects, so every little space conservation helps.

    Incidentally, the propeller tool automatically expands all tab to 8(!) spaces on loading a file, and if you then save it it overwrites the tabs with spaces.
  • BradCBradC Posts: 2,601
    edited 2009-06-07 09:16
    Fake-Name said...

    Incidentally, the propeller tool automatically expands all tab to 8(!) spaces on loading a file, and if you then save it it overwrites the tabs with spaces.

    This is the only easy way to manage the variable tab stops that the tool implements. You can't easily translate a file with fixed tab stops to the variable spacing used in the IDE.

    Personally I normally use vim with a TS of 4, but I've gotten used to the Propeller way of doing it.

    I'm surprised you are seeing the trailing spaces on the end of lines. That's pretty bletcherous behaviour on the part of the IDE if its actually doing that.

    I routinely swap between an IDE which tries to mimic the Propeller Tool behavior, gedit and vim and I don't have too many problems. Maybe the mixes between tabs and spaces juct become second nature, but as long as you remember that the IDE (and the compiler incidentally - if you have tabs in your source it will treat them as an 8 space indent) always translates a \t to 8 spaces you'll do ok.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "VOOM"?!? Mate, this bird wouldn't "voom" if you put four million volts through it! 'E's bleedin' demised!
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-06-07 09:44
    if you don't like the propeller-tool-IDE

    switch over to the propellent.dll combined with any editor you like.

    As INDENTION is used to identify structural details of the sourcecode
    there might be problems when using tabs. If your editor indent let's say 3 columms per tab
    and the propellent.dll tranlates a tab into 8 spaces this could change the structure of the sourcecode

    anyway: how do you jump through lines of code ?
    I do it by using ctrl-cursor-right or END + ctrl-cursor-left to jump from word to word

    what's so difficult about typing space space to indent ?

    more than two spaces moves indented parts of the sourcecode too fast out of sight
    and the cursor ist set to the colum from the line above

    so where at all is the problem ?

    best regards

    Stefan
  • Fake-NameFake-Name Posts: 7
    edited 2009-06-07 10:17
    StefanL38 said...
    if you don't like the propeller-tool-IDE

    switch over to the propellent.dll combined with any editor you like.


    Hm... I'm really not familliar with windows .dlls, but the propellant idea is interesting. I'll look into it
    StefanL38 said...


    As INDENTION is used to identify structural details of the sourcecode
    there might be problems when using tabs. If your editor indent let's say 3 columms per tab
    and the propellent.dll tranlates a tab into 8 spaces this could change the structure of the sourcecode


    As long as the translation is consistant, it'll be fine.
    StefanL38 said...


    anyway: how do you jump through lines of code ?
    I do it by using ctrl-cursor-right or END + ctrl-cursor-left to jump from word to word


    Fancy. I generally just use the arrow keys.
    StefanL38 said...


    what's so difficult about typing space space to indent ?


    Tabs are much cleaner, and that way, I don't have to fight the IDE when it decided to indend one line by 2 spaces when pressing tab, and another by 4 (yes, it does this to me regularly).
    StefanL38 said...



    more than two spaces moves indented parts of the sourcecode too fast out of sight
    and the cursor ist set to the colum from the line above


    What? You actually have line wrapping problems? What resolution is your screen? My normal editor window is 210 chars wide. (@ 1920 x 1200) 4 spaces vs 2 makes very little difference.
    StefanL38 said...


    so where at all is the problem ?

    best regards

    Stefan

    It's mostly convenience. If an application decides that Ctrl+V should be cut, and Ctrl+C should be paste, it shakes things up, and gets on your nerves, no? If you work in multiple languages regularly, little things really get on your nerves, particularly if programming gets on your nerves enough as it is.

    Post Edited (Fake-Name) : 6/7/2009 10:26:49 AM GMT
  • BradCBradC Posts: 2,601
    edited 2009-06-07 12:04
    Fake-Name said...


    Tabs are much cleaner, and that way, I don't have to fight the IDE when it decided to indend one line by 2 spaces when pressing tab, and another by 4 (yes, it does this to me regularly).


    Ahh, that is the variable tab stop feature. Check out the IDE preferences and you can set your tab stops to whatever you like. It works that way as it tries to make a relatively good prediction about how it thinks you might best indent your code.

    Each section has a different configuration for the tab stops as each section is generally structured differently.
    It's pretty neat once you get used to it.

    I would not bother with propellent.dll. Just use propellent as a command line compiler if you are using windows. It does run on WINE under Linux i386 also.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "VOOM"?!? Mate, this bird wouldn't "voom" if you put four million volts through it! 'E's bleedin' demised!
  • heaterheater Posts: 3,370
    edited 2009-06-07 12:52
    This confuses the hell out of me. Spin assigns meaning to white space. So what happens when my code is a mess of tabs and spaces having been in and out of various editors and IDEs. Some of which convert tabs to spaces or spaces to tabs and all have tabs of different sizes. Not to mention the disasters when one cuts and pastes code from say a WEB page. All of a sudden I cannot trust that the code I'm looking at has the same meaning as when it was written and I have no way to verify it.

    So what are the rules in Spin for interpretation of spaces and tabs into logical indentation levels?

    This is also a pain when using tools like diff to compare different versions. Often I go around "neatening" code by lining up tables and comments etc. With no semantic changes.
    That's OK in C for example as I can tell diff to ignore white space only changes and show me what has really changed. In Spin I end up with a huge diff output most of which is irrelevant but I have to check every change in case it's an important white space change.

    Is the a good way to handle that?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.

    Post Edited (heater) : 6/7/2009 12:59:48 PM GMT
  • jazzedjazzed Posts: 11,803
    edited 2009-06-07 14:33
    Using the Parallax font I mentioned refers to adding special characters to your file like schematic symbols, etc... If you do that, your file will never be normal ASCII again unless you copy/paste the contents to an editor incapable of handling the Parallax font. Maybe the tool does tab conversions with that kind of file too, but it certainly behaves like tabs are there making the cursor jump especially when I don't want it to [noparse]:)[/noparse].
    According to some discussions, it looks like SVN uses compression in the repository, but not the working copy of course. So the size argument for needing tabs with SVN does not appear valid. Even CVS uses compression. Old habits are just hard to break.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Steve


    Propalyzer: Propeller PC Logic Analyzer
    http://forums.parallax.com/showthread.php?p=788230
Sign In or Register to comment.