This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Re: Indenting and TAB key

13 replies
daniel
Joined: 2008-08-20,
User offline. Last seen 44 weeks 15 hours ago.
If you re-configure your indentation settings for JDT, TAB can potentially insert spaces instead of the tab character.

I think that this should be configurable in SDT as it is in JDT.  I really would not like it to force use of the tab character, partially because of my own personal Scala preferences, but also because the 2-space convention is indeed standard for Scala.

Daniel 

On Mon, Feb 16, 2009 at 9:46 AM, Silvio Bierman <sbierman@jambo-software.com> wrote:

Hello Daniel,

Sorry for responding directly earlier, I will repeat it here.

The Eclipse Java editor treats a TAB as a TAB, no more no less, unless you
are at the beginning of an empty line which is something I can understand.
But when I have a line with code and I add a TAB in front of it then that is
exactly what I get. (Of course I have the editor set to not replace TABs
with spaces).

Having TAB adjust the indentation is indeed a step forward. However, I
really want a TAB instead of spaces.

Silvio

--
View this message in context: http://www.nabble.com/Indenting-and-TAB-key-tp22039405p22039667.html
Sent from the Scala - Tools mailing list archive at Nabble.com.


Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: Indenting and TAB key
Daniel,

If the tab level that emacs gives you doesn't get you to where you want you can keep hitting it to add more.  Or configure indentation so that it works for your style (I really need to do that for multiline case expressions).  Or just turn the bugger off.

2009/2/16 Daniel Spiewak <djspiewak@gmail.com>
The JDT, CDT and DLTK behavior (thus, the de facto Eclipse standard) is to TAB to the appropriate level (filling out with the configured indentation chars) when to the left of that level.  Otherwise, when at the level or beyond it, TAB inserts another indentation level, whatever that entails.  For SDT, an indentation level is just 2 spaces, but for JDT it is usually one tab (\t).  I know that Emacs has a pretty set way of doing things, but its TAB behavior is one of the reasons I don't use it on a regular basis.  :-)  I think we should probably shoot for the standard Eclipse handling of TAB (which is also standard across other editors like jEdit, TextMate, NetBeans, IDEA, and I'm sure other editors of which I am unaware).

Daniel

On Mon, Feb 16, 2009 at 9:42 AM, Ricky Clarkson <ricky.clarkson@gmail.com> wrote:
For what it's worth, in emacs tab always indents to the right level, even if you're in the middle of text (if you're in a programming mode and not something like Fundamental).  There's a separate keybinding for inserting a literal tab.  I think that's a good way to go.

The Visual Studio devs plan on doing it the emacs way eventually.

2009/2/16 Daniel Spiewak <djspiewak@gmail.com>
If you think about it, almost every source code editor "takes away" the normal function of TAB and replaces it with "indent".  In fact, some editors (like jEdit) let you see this configuration explicitly.  The problem is the SDT editor is just a little dumb about how it decides the "smart indent" behavior when the TAB key is pressed.  Given that the indentation is hard-coded to 2-space, I don't think the TAB key should *ever* insert \t.  However, it should certainly indent another level, and selection + TAB would definitely be a desirable feature.

Daniel

On Mon, Feb 16, 2009 at 9:31 AM, Silvio Bierman <sbierman@jambo-software.com> wrote:

Hello all,

I have previously expressed that I am not always happy with the way the
Scala editor in the Eclipse plugin (2.7.3 final) autoindents my code. In
several places, but especially with inline XML the formatting is far from
what I would like and consider readable.

I can live with the fact that indenting is not configurable right now. But
the fact that the TAB key will only indent and not insert a TAB is very
annoying. Using TAB to indent when a block of text is selected is quite
common but taking away the normal function of inserting a TAB is quite
something else.

Is there any chance this can be changed or can we at least get some opt-out
mechanism?

Best regards,

Silvio Bierman

--
View this message in context: http://www.nabble.com/Indenting-and-TAB-key-tp22039405p22039405.html
Sent from the Scala - Tools mailing list archive at Nabble.com.





milessabin
Joined: 2008-08-11,
User offline. Last seen 33 weeks 3 days ago.
Re: Indenting and TAB key

On Mon, Feb 16, 2009 at 3:51 PM, Daniel Spiewak wrote:
> I think that this should be configurable in SDT as it is in JDT.

It's quite possible that it is now on trunk ... could you give it a
try and report back?

Cheers,

Miles

daniel
Joined: 2008-08-20,
User offline. Last seen 44 weeks 15 hours ago.
Re: Indenting and TAB key
Love to, but for some reason the nightly build site (both of them, actually) isn't working for me (3.5 M5, Cocoa x64).  Is this a known issue?

Daniel

On Mon, Feb 16, 2009 at 9:59 AM, Miles Sabin <miles@milessabin.com> wrote:
On Mon, Feb 16, 2009 at 3:51 PM, Daniel Spiewak <djspiewak@gmail.com> wrote:
> I think that this should be configurable in SDT as it is in JDT.

It's quite possible that it is now on trunk ... could you give it a
try and report back?

Cheers,


Miles

--
Miles Sabin
tel:    +44 (0)1273 720 779
mobile: +44 (0)7813 944 528
skype:  milessabin

Joshua.Suereth
Joined: 2008-09-02,
User offline. Last seen 32 weeks 5 days ago.
Re: Indenting and TAB key
I remember finding code in SDT where *some* of this tab behavior was hard-coded (and at two spaces I believe).   I also think it was in one of the layers that *isn't* aware enough of eclipse to use settings.  I can do more investigation, but hopefully this is just more justification that the refactoring I'm attempting on the plugin is indeed worthwhile.

-Josh

On Mon, Feb 16, 2009 at 10:59 AM, Miles Sabin <miles@milessabin.com> wrote:
On Mon, Feb 16, 2009 at 3:51 PM, Daniel Spiewak <djspiewak@gmail.com> wrote:
> I think that this should be configurable in SDT as it is in JDT.

It's quite possible that it is now on trunk ... could you give it a
try and report back?

Cheers,


Miles

--
Miles Sabin
tel:    +44 (0)1273 720 779
mobile: +44 (0)7813 944 528
skype:  milessabin

Silvio Bierman
Joined: 2009-02-16,
User offline. Last seen 1 year 16 weeks ago.
Re: Indenting and TAB key

Miles Sabin wrote:
>
> On Mon, Feb 16, 2009 at 3:51 PM, Daniel Spiewak
> wrote:
>> I think that this should be configurable in SDT as it is in JDT.
>
> It's quite possible that it is now on trunk ... could you give it a
> try and report back?
>
> Cheers,
>
>
> Miles
>

milessabin
Joined: 2008-08-11,
User offline. Last seen 33 weeks 3 days ago.
Re: Indenting and TAB key

On Mon, Feb 16, 2009 at 4:04 PM, Daniel Spiewak wrote:
> Love to, but for some reason the nightly build site (both of them, actually)
> isn't working for me (3.5 M5, Cocoa x64). Is this a known issue?

It is if you've had problem with 3.5M5 since,

https://lampsvn.epfl.ch/trac/scala/changeset/17068

Any help with Mac OS specific issues would be very much appreciated.

Cheers,

Miles

milessabin
Joined: 2008-08-11,
User offline. Last seen 33 weeks 3 days ago.
Re: Indenting and TAB key

On Mon, Feb 16, 2009 at 4:09 PM, Silvio Bierman
wrote:
> Can I try that with the nightly build? If so, will that work with an Eclipse
> 3.5 Milestone build? Sorry for taking this thread off topic but I have
> previously had to revert to 3.4.1 to get the SDT working. If I go to the
> nightly builds and live on the edge I would like to push my Eclipse forward
> at the same time if possible.

If you work with the bleeding edge you have to expect to ... bleed
occasionally ;-)

That said, trunk is looking quite good at the moment (at least for me
on Linux). Nevertheless I would recommend creating a parallel
3.5M5/trunk installation rather than replacing your existing mostly
working one.

Cheers,

Miles

ijuma
Joined: 2008-08-20,
User offline. Last seen 22 weeks 2 days ago.
Re: Indenting and TAB key

On Mon, Feb 16, 2009 at 4:44 PM, Miles Sabin wrote:
> That said, trunk is looking quite good at the moment (at least for me
> on Linux).

Does that mean you are not affected by the following bugs?

https://lampsvn.epfl.ch/trac/scala/ticket/1716
https://lampsvn.epfl.ch/trac/scala/ticket/1717

I had to revert back to the revision before
https://lampsvn.epfl.ch/trac/scala/changeset/17107 because of them.

Best,
Ismael

daniel
Joined: 2008-08-20,
User offline. Last seen 44 weeks 15 hours ago.
Re: Indenting and TAB key
I don't know if it works or not, because I can't install it.  :-)  I just don't see anything available in the update site.  I can see the 2.7.3 update site (and that version certainly doesn't work), but not the nightly.

Daniel

On Mon, Feb 16, 2009 at 10:42 AM, Miles Sabin <miles@milessabin.com> wrote:
On Mon, Feb 16, 2009 at 4:04 PM, Daniel Spiewak <djspiewak@gmail.com> wrote:
> Love to, but for some reason the nightly build site (both of them, actually)
> isn't working for me (3.5 M5, Cocoa x64).  Is this a known issue?

It is if you've had problem with 3.5M5 since,

 https://lampsvn.epfl.ch/trac/scala/changeset/17068

Any help with Mac OS specific issues would be very much appreciated.

Cheers,


Miles

--
Miles Sabin
tel:    +44 (0)1273 720 779
mobile: +44 (0)7813 944 528
skype:  milessabin

milessabin
Joined: 2008-08-11,
User offline. Last seen 33 weeks 3 days ago.
Re: Indenting and TAB key

On Mon, Feb 16, 2009 at 4:49 PM, Ismael Juma wrote:
> Does that mean you are not affected by the following bugs?
>
> https://lampsvn.epfl.ch/trac/scala/ticket/1716
> https://lampsvn.epfl.ch/trac/scala/ticket/1717
>
> I had to revert back to the revision before
> https://lampsvn.epfl.ch/trac/scala/changeset/17107 because of them.

Just about to commit a fix for #1716 and will deal with #1717 ASAP ...

Thanks for the reports and patches BTW :-)

Cheers,

Miles

ijuma
Joined: 2008-08-20,
User offline. Last seen 22 weeks 2 days ago.
Re: Indenting and TAB key

On Mon, Feb 16, 2009 at 5:05 PM, Miles Sabin wrote:
> Just about to commit a fix for #1716 and will deal with #1717 ASAP ...

Thanks. :)

> Thanks for the reports and patches BTW :-)

No problem. Hopefully reports will be accompanies with a patch more
often in the future. ;)

Ismael

Silvio Bierman
Joined: 2009-02-16,
User offline. Last seen 1 year 16 weeks ago.
Re: Indenting and TAB key

Miles Sabin wrote:
>
> On Mon, Feb 16, 2009 at 4:09 PM, Silvio Bierman
> wrote:
>> Can I try that with the nightly build? If so, will that work with an
>> Eclipse
>> 3.5 Milestone build? Sorry for taking this thread off topic but I have
>> previously had to revert to 3.4.1 to get the SDT working. If I go to the
>> nightly builds and live on the edge I would like to push my Eclipse
>> forward
>> at the same time if possible.
>
> If you work with the bleeding edge you have to expect to ... bleed
> occasionally ;-)
>
> That said, trunk is looking quite good at the moment (at least for me
> on Linux). Nevertheless I would recommend creating a parallel
> 3.5M5/trunk installation rather than replacing your existing mostly
> working one.
>
> Cheers,
>
>
> Miles
>

Joshua.Suereth
Joined: 2008-09-02,
User offline. Last seen 32 weeks 5 days ago.
Re: Indenting and TAB key

Like I tried to send earlier, we need to move some of the layers in
the virtual class pattern higher in the model so we have access to the
preferences. I'm currently working on flattening these layers, but
it's slow going for one not intimately familiar with the source.

Sent from my iPhone

On Feb 18, 2009, at 5:23 AM, Silvio Bierman wrote:

>
>
>
> Miles Sabin wrote:
>>
>> On Mon, Feb 16, 2009 at 4:09 PM, Silvio Bierman
>> wrote:
>>> Can I try that with the nightly build? If so, will that work with an
>>> Eclipse
>>> 3.5 Milestone build? Sorry for taking this thread off topic but I
>>> have
>>> previously had to revert to 3.4.1 to get the SDT working. If I go
>>> to the
>>> nightly builds and live on the edge I would like to push my Eclipse
>>> forward
>>> at the same time if possible.
>>
>> If you work with the bleeding edge you have to expect to ... bleed
>> occasionally ;-)
>>
>> That said, trunk is looking quite good at the moment (at least for me
>> on Linux). Nevertheless I would recommend creating a parallel
>> 3.5M5/trunk installation rather than replacing your existing mostly
>> working one.
>>
>> Cheers,
>>
>>
>> Miles
>>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland