eclipse-xtext / eclipse-xtext/xtext
Formatter produces garbage
Open
@szarnekow is already working on this.
Since Aug 14, 2018.
bug
- Dominant language
- Java
- Stars
- 831
- Forks
- 330
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 12
Description
When formatting the following code, the Xtend formatter produces garbage:
package com.btc.serviceidl.generator.cpp
import java.util.Collection
import org.eclipse.emf.ecore.EObject
class CodecGenerator
{
Object typeResolver
def generateHeaderFileBody(EObject owner)
{
var Collection<EObject> nested_types
'''
«FOR type : nested_types»
«/* TODO */»
«val proto_type_name = typeResolver.toString»
«ENDFOR»
'''
}
}
The result is:
package com.btc.serviceidl.generator.cpp
import java.util.Collection
import org.eclipse.emf.ecore.EObject
class CodecGenerator
{
Object typeResolver
def generateHeaderFileBody(EObject owner)
{
var Collection<EObject> nested_types
'''
«FOR type : nested_types»
«/* TODO */»
«val proto_type e = typeResolver.toString»
«ENDFOR»
'''
}
}
Parts of the name of the proto_type_name variable are replaced by spaces here, and the indentation is also not correct. The comment in the line before seems to confuse the formatter.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.