public class Bar {
> public int wazoo;
> }
>
> There is enough Information to know that the standard indentation is 1
> tab, but you don’t have enough information to know what the label
> indentation or continuation indentation should be.
The hard part is dealing with ambiguity. Real sources with a long history
may contain a mix of tabs and spaces, different indent levels etc.
Not to mention more esoteric things - for example, spaces inside
parentheses and how that deals with nested parentheses - e.g. “foo( bar(
baz ))” good and “foo( bar( baz ) )” bad (I have yet to find an incantation
off NetBeans’s own formatter that gets this right.
If you just want to detect tabs or spaces and how many, that might be a
$200 job. For detecting everything and not getting at least one thing
embarrassingly wrong, likely $100k is not enough.
So if someone does this, choose carefully what problems you DON’T want to
solve, or plan on going down an infinitely deep rabbit hole.
-Tim
>
The plugin would need to fall back to the NetBeans prefs to "figure out"
> sensible values for these.
>
> While not rocket science, this isn’t entirely straightforward because you
> can’t just copy the NetBeans prefs. Continuing the example above, if
> NetBeans specifies that the standard indentation is 2 spaces and the
> continuation indentation is also 2 spaces, you can figure out that the
> continuation indentation for this file should be one tab. If in NetBeans
> the continuation indentation was 4 spaces (twice the standard indentation),
> the continuation indentation for this file should be 2 tabs.
>
> -Alvin
>
> --
http://timboudreau.com