Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-dev] Changing the default line separator for text files.

JDT Core is now using the new preference for getting the line separator
when creating a new file.

Jerome



                                                                           
             Mike Wilson                                                   
             <Mike_Wilson@ca.i                                             
             bm.com>                                                    To 
             Sent by:                  eclipse-dev@xxxxxxxxxxx,            
             eclipse-dev-bounc         cdt-dev@xxxxxxxxxxx,                
             es@xxxxxxxxxxx            wtp-dev@xxxxxxxxxxx                 
                                                                        cc 
                                                                           
             05/19/2005 05:26                                      Subject 
             PM                        [eclipse-dev] Changing the default  
                                       line separator for text files.      
                                                                           
             Please respond to                                             
                 "General                                                  
                development                                                
              mailing list of                                              
                the Eclipse                                                
                 project."                                                 
                                                                           
                                                                           




Bug 3970 is one of the oldest (so old that it actually predates our use of
bugzilla) and most highly voted on (74 votes, 39 people on the CC list)
open feature requests. Over the years, we have done a significant number
of things to address issues related to line separators, but we never
actually added the feature that this bug describes; that is, a simple way
to specify what line separator character will be used when new text files
are created.

For Eclipse R3.1, we will (finally) be addressing this by providing both
the necessary plumbing (preferences, GUI to set them, etc.) and associated
support in the SDK text file creation code. I encourage all developers
whose plug-ins create text files to take a look at
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=3970
and the dependent bugs, and consider whether they should be using the new
support to allow new text files to be created with line separators that
differ from the platform ones (e.g. to use Linux ("\n") separators on
Windows ("\r\n") platforms).

IMPORTANT: This is not a breaking change. Existing code that creates text
files, but which does not make use of the new support, will continue to
work as it always has. Typically, this means that the platform line
separator will be used, but this is (still) at the discretion of the
plug-in.

For added context, here is an excerpt from bug 3970 (see the bug for
more)....

------------------------

In the current Eclipse R3.1 development builds the following support for
custom line separators already exists [yes, you probably know this
already]:

1) When opened on an existing text file that contains line separators, the
standard Eclipse editors detect which line separator the file uses, and
continue to use that one as new lines are added. This should prevent
"mixed" line separators from appearing in files.

2) The CVS repository provider (i.e. the Eclipse code we wrote to talk to
CVS) has a preference checkbox "Convert text files to use platform line
ending", which can be found in the "Files and Folders" tab of the "CVS"
preference page (under the "Team" preference page). By default this
preference is checked, but if you *uncheck* it, CVS will not modify the
line separators of text files when they are checked out of (or into) CVS.
This, together with point 1), should allow a team with developers working
on multiple platforms to work with existing text files without causing the
line separator to be modified.

3) As Dani mentioned above, the "File" > "Convert Line Delimiters To" menu
operation can now be applied to whatever is selected, be they files,
folders or projects. This should allow wholesale conversion of existing
text files without grief.

Honestly, I think this already a pretty good story, but none of it
actually addresses the feature requested by this bug: "UI needed to define
the default line delimiters for new files". So here's what we're going to
do:

1) We'll provide a per-project preference that allows you to choose what
you want the default line separator to be for new text files created in
that project. By putting it on the project, the value will be shared with
the project. This, together with the features described above, lets a team
of developers working on the shame project always use a particular line
separator both when editing existing files and creating new ones.

2) We'll provide the same kind of preference for the workspace as a whole.
This will be used for projects that do not explicitly have the preference
set. Note that, if you want the line separator setting to "stick" to your
work, you will want to use the project setting rather than this one
(because even if you weren't sharing the project, you would have to
remember re-set it every time you got a new workspace).

3) We'll modify the standard places where text files are created to detect
and use these properties. One *very* important thing to keep in mind about
this is that, we don't have control over all of the text file creating
tools that have been written by the Eclipse community. Some of these, by
nature of how they fit into the underlying frameworks, may do the right
thing with the new preferences, some probably won't. I presume you will
take on the task of evangelizing the need to support this new capability
with the authors of the plugins you care about. ;-)

------------------------

You should see these changes showing up in current nightly builds. The GUI
for setting the preferences can be found in the Project > Properties >
Info page and the Window > Preferences > General > Editors page.

McQ.


_______________________________________________
eclipse-dev mailing list
eclipse-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipse-dev




Back to the top