Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 55356 - templates should be formatted on insert
Summary: templates should be formatted on insert
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Ant-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 57509 (view as bug list)
Depends on: 55355
Blocks:
  Show dependency tree
 
Reported: 2004-03-19 08:20 EST by John-Mason P. Shackelford CLA
Modified: 2009-08-30 02:23 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John-Mason P. Shackelford CLA 2004-03-19 08:20:14 EST
The templates should be properly indented on insert. Given recent rewrites of 
the ant editor formatter we ought also to be able to format tags as specified 
in the user preferences.
Comment 1 John-Mason P. Shackelford CLA 2004-03-19 08:20:28 EST
From a mail on eclipse-platform-text (Tom Eicher 3/19/2004)

> About the formatting: This is something the template context is 
> responsible for, since there may be many different context types in a 
> document (context types map to partitions in many ways) that have 
> different formatters. A template context contains all the information 
> needed to evaluate a template at a specific location in a document.

> For an example, the JavaContext does that already: it formats (well, it 
> tries to...) a code template when it evaluates it. So, when you add your 
> Ant context type, you might add a specific AntContext which will extend 
> the default TemplateContext with formatting capabilities.

Comment 2 John-Mason P. Shackelford CLA 2004-04-05 14:44:49 EDT
At present the document formatter responsible for fixing the indentation 
doesn't know how to format anything but the whole document at once. I'd like to 
add support so that it respects a selected region. You could then use this to 
format the inserted templates. On the other hand, if you already have code in 
the auto-indent strategy to handle this it might be faster to do it that way. 
We can always make the support more robust later.
Comment 3 Darin Swanson CLA 2004-04-14 17:56:05 EDT
I have got the formatting working but I really do not see how to easily update 
the position of the variables in the template.

What the Java guys do is create a document, add a position updater to the 
document, add positions to the document for all of the offset of the variables 
in the document, then update the variables with the new positions after the 
doc has been modified.

I think we can do the same thing in our formatter...but phew!! more than I had 
anticipated :-)
Comment 4 Darin Swanson CLA 2004-05-17 22:48:15 EDT
The code is all there in AntContext but does not quite work for fixing up the 
positions of the template variables (so it is disabled).

Should be possible to tweak post M9
Comment 5 Darin Swanson CLA 2004-05-22 12:16:57 EDT
*** Bug 57509 has been marked as a duplicate of this bug. ***
Comment 6 Darin Swanson CLA 2004-05-26 19:53:38 EDT
Still disabled but I have moved the code to use the XmlFormatter and moved the 
support for formatting the template buffer to this class.

Still got to figure out why the variable positions are not updated correctly...
Comment 7 Darin Swanson CLA 2004-05-26 19:54:56 EDT
Changes to AntContext, XmlDocumentFormatter, XmlDocumentFormattingStrategy and 
XmlFormatter.
Comment 8 Darin Swanson CLA 2004-05-27 23:52:23 EDT
Removed the preference from the preference page...sigh
Comment 9 Darin Swanson CLA 2004-06-01 13:34:07 EDT
Deferred to post 3.0
Comment 10 Denis Roy CLA 2009-08-30 02:23:44 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.