Community
Participate
Working Groups
If you have a Java Editor Template that has leading whitespace it is trimmed off before the template is inserted into the Java editor. For some templates leading whitespace is valuable, so it would be nice if templates were inserted verbatim.
Simon, do you have a concrete example?
I had added an nls1 template that inserted " //$NON-NLS-1$", and I always wanted the leading space. Likewise for the default nls template, since I did not want multiple NLS tags to run together. I realize that this is a minor gripe, but regardless, it makes sense that if the template includes leading, or trailing, whitespace that it be honored. Thanks.
Why do you need the NLS template? There's a quick fix for this which does the trick for you ;-) We auto-indent the whole template for you and run it through the formatter (the latter can be disabled). To make this right we would have to introduce some sort of hard (white)space.
Clearly the use-case here is pretty narrow, so I would not want you to invest too much into this. If it's easy to just respect leading/trailing whitespace (as in, don't call trim() before insertion), then I'd say, just do it, otherwise, I would not mind this being shelved. Thanks.