Formatting
-
Ugh. I need an editor command that will take a long block of assignment statements and align them all on the =.
Because my code needs to look pretty, dammit!
-
Fixed Format RPG code is way
-
Isn't there a setting in the Visual Studio Power Tools for that?
-
Sublime to the rescue!
That was selecting
.=
, CtrlD to select them all, ←, TabOk, it was
=
in your case, misread.... fuck it!
-
Norepro
-
Oh, right, the last one... damn that thing.
There's probably a way to do that, too, but I can't figure out anything right now.
-
Does Sublime do syntax highlighting for Progress? If not, that's cool but not all that helpful.
What about Eclipse, can you do that in Eclipse?
-
Does Sublime do syntax highlighting for Progress?
Doesn't look like it does by default but someone's probably made a highlight package for it (or for TextMate, which Sublime can use).
-
Doesn't look like it does by default but someone's probably made a highlight package for it (or for TextMate, which Sublime can use).
Eclipse would still probably be a better choice for me, because Progress supplies a customized version with language/VM/etc support.
-
in Notepad++, alt draw box selection, hit tab.
-
in Notepad++, alt draw box selection, hit tab.
Nice, but I don't want to save my file, fire up N++, use it for 5 seconds to do this one bit of formatting, then reload the file in Eclipse and continue about my day.
-
It's not so bad. At work I mostly use Eclipse or VS (depending on the project), and while working in either one I've copied my code/settings file/whatever into Sublime, done some text processing, and copied it back to the IDE.
-
I don't want to break your brain here.... but...
Does it work in Eclipse too?
-
It's not so bad.
Ah. I shoudl point out that, due to working at a remote office, I have to work on a slow filesystem that has two tin cans and a piece of string somewhere in the network. It takes up to ~15 seconds simply to save a file. The files I work with are frequently up to 5-6 levels or more deep in the directory structure, so to open a file, I can either type in the full path and hope I don't make a typo, or use the File Open dialog's GUI to navigate to the directory, where each new directory takes up to another ~15 seconds to load. It's painful, IOW.
-
I don't want to break your brain here.... but...
Does it work in Eclipse too?
=-aligning? No idea. I did ask above.
The language vendor provides, as I said, a customized Eclipse environment including syntax highlighting and all the usual fun stuff. I don't need to align a bunch of assignment statements very often but it's nice to have a convenience function to do it.
-
Can you copy and paste? I usually don't touch the file system whenever I'm going between Sublime and Eclipse.
-
It's not a magical solution, but it works to align that one group with the other group.
blah blah blae blah blargle blah
but it won't work if
blah blah blae blah blargle blah blae blah blargle blah
-
Can you copy and paste? I usually don't touch the file system whenever I'm going between Sublime and Eclipse.
Yeah, I could do that, I guess.
-
Your second example is more like what I'd normally run into (think generated code).
-
Ok, I don't have your environment, so I'm doing this blind, but did you try this?
link in question
-
the accepted answer on SO's first comment is " was hoping for something that would align = signs across several lines of assignment statements"
-
http://columns4eclipse.sourceforge.net/
<not empty>
-
IntelliJ's autoformatter can do this out-of-the-box, IIRC.
-
I hate you for wanting to do this.
-
IntelliJ's autoformatter can do this out-of-the-box, IIRC.
That's be awesome if I were writing Java.
-
I hate you for wanting to do this.
Oh, so you like your formatting like this?
[code]struct.f = 12;
struct.longname = "this is a test";
struct.ohgodwhyisthissuchalongname = x;
struct.field3 = 17;
struct.field31 = "X";
struct.field_12 = otherstruct.Field_a;
[/code]
?
-
@JoeCool said:
I hate you for wanting to do this.
Oh, so you like your formatting like this?
I prefer this:
[code]struct.f = 12;
struct.field3 = 17;
struct.field31 = "X";
struct.longname = "this is a test";
struct.field_12 = otherstruct.Field_a;
struct.ohgodwhyisthissuchalongname = x;
[/code]
-
Well if those are your field names, you're in deep shit anyway.
I personally don't mind. Pretty much the only places where the formatting gets awkward for me are switch-ternaries:
var result = (x == 1) ? 1 : (x == 2) ? 2 : 3
and occasionally long argument lists:
func(someObject, otherObject, andOneMore);
I've never really needed whitespace in the middle of the line.
-
file in Eclipse
In the context of
=-aligning? No idea. I did ask above
Where you didn't :)
@FrostCat said:Ugh. I need an editor command that will take a long block of assignment statements and align them all on the =.
Because my code needs to look pretty, dammit!
Might of helped ( - 'cos I'm not having a go at you, just ironic at myself because I was in a position of being the first respondent and asking you "what editor" but CBA 'cos I wanted to see how others reacted)
-
FillsItInWithSpaces
Also known as NotAPsychopathWhoseFilesBecomeUnreadableWithoutShittyFoistware.
Nick Gravgaard is doing it wrong. It shouldn't be the programmer's responsibility to typeset source code at all, let alone with some incompatible new format.
Oh hey and @magus, or whoever the op of that heretical fonts thread was, while I was googling this shit I found a proportional font that I suppose could be acceptable for coding http://input.fontbureau.com/info/
-
Quick DuckDuckGoing gave me this:
Preferences → Java → Code Style → Formatter → goto Edit and check the Align fields in columns
-
-
I've never really needed whitespace in the middle of the line.
because if a variable/property name changes, now all those aligned equal signs become maddeningly unaligned.
I dont like choosing a formatting method that breaks by default.
-
May you be successful in your quest...and then find out that the checkin to source control standardizes formatting, and removes all of the extra spaces automatically.
-
Quick DuckDuckGoing gave me this:
Preferences → Java → Code Style → Formatter → goto Edit and check the Align fields in columns
http://i.imgur.com/2U6r2xp.png
Got turned into:
http://i.imgur.com/rNgYTKF.png
eclipse_formatter += all_my_hate;
-
Click "Format". Go ahead and mess with the whitespace before doing so.
-
I've never really needed whitespace in the middle of the line.
I like it like @FrostCat does. Makes my code purrrty.
-
@JoeCool said:
I hate you for wanting to do this.
Oh, so you like your formatting like this?
[code]struct.f = 12;
struct.longname = "this is a test";
struct.ohgodwhyisthissuchalongname = x;
struct.field3 = 17;
struct.field31 = "X";
struct.field_12 = otherstruct.Field_a;
[/code]
?I actually do prefer a consistent amount of whitespace on either side of the
=
sign.
I can kind of see the appeal of purty alignment, but I just don't see why you'd want to take on the additional maintenance burden of realigning the code every time a variable is added/removed/renamed fromstruct
(and it makes for noisier diffs when you're going through the code history).Filed under: [code]broken formatting
-
I just don't see why you'd want to take on the additional maintenance burden of realigning the code every time a variable is added/removed/renamed from struct
Because that doesn't happen all that often, mainly.
-
-
That input font looked nice.
-
Did you know there's a whole site seemingly devoted to open-source web-friendly fonts?
-
Oh, so you like your formatting like this?
struct.f = 12;
struct.longname = "this is a test";
struct.ohgodwhyisthissuchalongname = x;
struct.field3 = 17;
struct.field31 = "X";
struct.field_12 = otherstruct.Field_a;?
Yes.
However, I once worked with someone who formatted like this, and it is much worse:
struct.f = 12; struct.longname = "this is a test"; struct.ohgodwhyisthissuchalongname = x; struct.field3 = 17; struct.field31 = "X"; struct.field_12 = otherstruct.Field_a;
-
> struct.f = 12;
struct.longname = "this is a test";
struct.ohgodwhyisthissuchalongname = x;
struct.field3 = 17;
struct.field31 = "X";
struct.field_12 = otherstruct.Field_a;Hey, I like that (not that I do that in code, but I do for form fields and similar) because I can track my eye down the "=" (in this case) and take in bothe sides without having to flick left and right and risk "jumping a line"