Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Autoformat: The comment preceding an element is not indented correctly.
Autoformat: The comment preceding an element is not indented correctly. [message #1258736] Thu, 27 February 2014 17:59 Go to next message
Tatiana Fesenko is currently offline Tatiana FesenkoFriend
Messages: 62
Registered: July 2009
Member
Hi,

I found strange behavior of auto-formatting for comments.
Comments preceding an element follow the indentation rules of the parent element:
http://oi59.tinypic.com/24l8rvl.jpg
Expected behaviour is to have the same indents as the commented element:
http://oi62.tinypic.com/p3gom.jpg

This behaviour can be seen in the editor for Xtext grammar itself and generated editors.

This issue was discussed in another project. We solved this issue by using a modification of their formatter stream which overrides writeHidden() and writeSemantic() methods.

It works, but is there is a better solution?

Thanks,
Tanya
Re: Autoformat: The comment preceding an element is not indented correctly. [message #1258753 is a reply to message #1258736] Thu, 27 February 2014 18:22 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The Xtext problem is https://bugs.eclipse.org/bugs/show_bug.cgi?id=405184

Regards

Ed Willink

On 27/02/2014 17:59, Tatiana Fesenko wrote:
> Hi,
>
> I found strange behavior of auto-formatting for comments. Comments
> preceding an element follow the indentation rules of the parent element:
>
> Expected behaviour is to have the same indents as the commented element:
>
> This behaviour can be seen in the editor for Xtext grammar itself and
> generated editors.
> This issue was
> https://code.google.com/p/protobuf-dt/issues/detail?id=132 in another
> project. We solved this issue by using a modification of
> https://code.google.com/p/protobuf-dt/issues/attachmentText?id=132&aid=1320001000&name=ProtobufFormatter.java&token=ov2NSJUHUZdmrRYR5iwmOzOH_nI%3A1393449309373
> which overrides writeHidden() and writeSemantic() methods.
> It works, but is there is a better solution?
>
> Thanks, Tanya
Re: Autoformat: The comment preceding an element is not indented correctly. [message #1699491 is a reply to message #1258736] Wed, 24 June 2015 14:59 Go to previous message
ayman salah is currently offline ayman salahFriend
Messages: 131
Registered: June 2015
Senior Member
Did you get it to work this way? If not, did you find a solution? I am trying to implement it and it is giving me a null exception when trying to
return new MyTokenStream(out, indent, getConfig(), createMatcher(), getHiddenTokenHelper(), preserveWhitespaces);


Quote:
Hi,

I found strange behavior of auto-formatting for comments.
Comments preceding an element follow the indentation rules of the parent element:

Expected behaviour is to have the same indents as the commented element:


This behaviour can be seen in the editor for Xtext grammar itself and generated editors.

This issue was discussed in another project. We solved this issue by using a modification of their formatter stream which overrides writeHidden() and writeSemantic() methods.

It works, but is there is a better solution?

Thanks,
Tanya
Previous Topic:Hexcode terminal vs Named Colors terminal. Terminal structuring problem.
Next Topic:Xtext uses Libraries from other Java Projects in Workspace
Goto Forum:
  


Current Time: Thu Mar 28 17:23:35 GMT 2024

Powered by FUDForum. Page generated in 0.02775 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top