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

Indenting and TAB key

4 replies
Silvio Bierman
Joined: 2009-02-16,
User offline. Last seen 1 year 16 weeks ago.

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

daniel
Joined: 2008-08-20,
User offline. Last seen 44 weeks 15 hours ago.
Re: Indenting and TAB key
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.


Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: Indenting and TAB key
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.



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

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

daniel
Joined: 2008-08-20,
User offline. Last seen 44 weeks 15 hours ago.
Re: Indenting and TAB key
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.




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