Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367919 - [Xbase ] compiler doesn't respect the workspace line ending preference for new files
Summary: [Xbase ] compiler doesn't respect the workspace line ending preference for ne...
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.1.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: M5   Edit
Assignee: Jan Koehnlein CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 347782
  Show dependency tree
 
Reported: 2012-01-05 03:50 EST by Ed Merks CLA
Modified: 2017-09-19 17:20 EDT (History)
4 users (show)

See Also:
sven.efftinge: juno+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Merks CLA 2012-01-05 03:50:56 EST
It appears that the Xtend compiler on Windows will always produce CR/LF in its results even when the workspace preference (Window->Preferences->General->Workspace->New text file line delimiter) for new files is set to LF (Unix).  This makes it hard to use the platform team's approach for working with EGit: http://wiki.eclipse.org/Platform-releng/Git_Workflows#Dealing_with_line_terminators
Comment 1 Sebastian Zarnekow CLA 2012-01-05 04:13:29 EST
We should try to find a solution for the line endings in strings that are produced by template expressions, too. Currently it's always the system property 'line.seperator'
Comment 2 Jan Koehnlein CLA 2012-01-06 11:44:30 EST
Pushed an initial version to MASTER.

We now use a post processor in AbstractFileSystemAccess to convert newlines to something specified using an IWhitespaceInformationProvider. Ed, your scenario should be solvable now by setting the line separator of the project or the Eclipse instance.

IAppendable now has a newLine() method to append a line separator. The StringBasedAppendable allows to configure this, such that we can pick up the right line separator form the document or using the IWhitespaceInformationProvider, e.g. in the quick fixes for Xtend. So now the appendable keeps track of the line separator the same way it does with the indentation. 

For template expressions, I think we should get the line separator from the IAppendable handed in which in turn should be initialized with the Xtend source file's line separator (and indentation?).

One issue remains with the CompilationStrategies: The Java versions currently build their own appendable to be able to serialize types and handle imports correctly. That appendable should also be initializable, maybe resulting in a different interface for the strategies. OTOH, the interface is designed such that you can use a closure instead. I am not yet sure how to handle this.
Comment 3 Jan Koehnlein CLA 2012-01-17 08:12:08 EST
For template expressions, it seems to be a good idea to stick with a static default line delimiter, in order to avoid platform specific subtemplates. The postprocessing in the IFileSystemAccess will harmonize separators anyway. 

I am leaving the rest as is and close this ticket.
Comment 4 Karsten Thoms CLA 2017-09-19 17:08:32 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 5 Karsten Thoms CLA 2017-09-19 17:20:03 EDT
Closing all bugs that were set to RESOLVED before Neon.0