| Summary: | Need two templates for each construct; line_selection and word_seection | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Alex Blewitt <alex.blewitt> |
| Component: | Text | Assignee: | JDT-Text-Inbox <jdt-text-inbox> |
| Status: | RESOLVED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 2.1 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
I think you can have both ${line_selection} and ${word_selection} in the same
template.
I think it would be more beneficial to provide a pseudo-variable
${text_selection} than require all templates to be written with a
${line_selection}${word_selection} combination.
If this is not the case, /all/ of the default templates need to be checked
in Eclipse and ${xxx_selection} needs to be replaced with ${line_selection}${word_selection} (or the other way around?)
For example, the 2.1RC1 defines the 'if' template as
if (${test}) {
${line_selection}
}
This should be updated to
if (${test}) {
${word_selection}{$line_selection}
}
and similarly for all the remaining templates that use either word_ or line_
and can be applied for both.
IMHO the text_selection would be easier to maintain from a user-of-templates
PoV than having to remember to put both each time.
This is never going to get fixed; it may already be processed in the current implementation. |
The introduction of ${line_selection} allows multiple lines to be used inside a template, whereas ${word_selection} uses a single line only. However, it is (currently) not possible to have one template that acts both for words and for lines at the same time. Instead, the template must be duplicated with the only change being ${word_selection} instead of ${line_selection} at the appropriate place. This prevents a generic template (say, for if-statements) to work if the user only selects a single line, which may be confusing for the novice user. I propose that either: A) The line_selections also show up in word_selection code-assists or B) A new text_selection is created for both multiple lines and single lines See also bug 32704