[Swift-devel] Code style

Mihael Hategan hategan at mcs.anl.gov
Wed May 15 00:09:20 CDT 2013


On Tue, 2013-05-14 at 23:44 -0500, Justin M Wozniak wrote:
> On 05/14/2013 11:20 PM, Mihael Hategan wrote:
> > On Tue, 2013-05-14 at 22:57 -0500, Justin M Wozniak wrote:
> >>
> >> I put the note about tabs in the document as a note to new developers
> >> and a concession to the fact it was used so much in the existing code.
> >> If anyone can add some notes on there about how to best get this working
> >> in the latest Eclipse and Emacs, that would help a lot (I don't think I
> >> ever got it working with Emacs).
> > What do you mean by "this"?
> 
> The tabs/spaces thing.  Can the Eclipse settings be exported and 
> posted?

Actually, yes. Here's what I used in CoG (and what Swift inherited). It
uses spaces.

>   (Now that I think about it, I use the Emacs key settings in 
> Eclipse, with tab mapped to indent, which maybe made it harder for me to 
> adapt to the tabs+spaces convention.  Maybe this is easier for others.)
> 

These settings are for the formatter. By default, eclipse won't change
tabs into spaces or the other way around (unless you explicitly
re-format the code), but new things you write are affected by these
settings. For existing files it looks like it will copy existing
indentation if you hit enter, but then do its own when you indent
further.

So with spaces on and if you hit enter then tab on some existing line
that goes like

<TAB><TAB>if (i == 0) {

You get

<TAB><TAB>    //<-- you are here

Mihael

-------------- next part --------------
A non-text attachment was scrubbed...
Name: spaces2.xml
Type: application/xml
Size: 29585 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20130514/3130f35c/attachment.xml>


More information about the Swift-devel mailing list