Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[wtp-dev] Formatter vs Indenter in JSDT


This is a question related to JSDT indenter which I hope this is the right place to ask.

The basic problem is that indenter and formatter are not consistent. For example with some formatter preferences tweaks, I can get 4 spaces before '[' in:

var t =
      'a', 'b'

which is what I want. However if I select this segment and just run indenter it changes the indent to 2 spaces. I cannot find any JSDT settings that changes this indenter behavior. Debugging the code a little bit it seems that org.eclipse.wst.jsdt.internal.ui.text.JavaIndenter has a CorePrefs internal class with a prefAssignmentIndent field that determines this indent. However this indent size is simply set to prefBlockIndent() which is (eventually) hard-coded 1. So

(i) Is this behavior intended?
(ii) If not is there any plan/open-bug to fix it? If yes, why (i.e., shouldn't formatter and indenter be consistent)?


Bashir S. Sadjad
Google Waterloo, Canada

Back to the top