Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Vscode extension formatting has different behavior than Eclipse(Different outputs when formatting directly in Eclipse and when packaged into a Vscode extension)
Vscode extension formatting has different behavior than Eclipse [message #1852922] Fri, 10 June 2022 16:08 Go to next message
Luke Chieng is currently offline Luke ChiengFriend
Messages: 1
Registered: June 2022
Junior Member
I have implemented a formatter extending AbstractFormatter2 that works as expected in Eclipse by right-clicking 'Format' on selected dsl text. I packaged my dsl and formatter into a vscode extension with a language server. Now, when trying to format files in vscode by right-clicking 'Format Document' , only part of the formatter works (one keyword formats correctly but the other doesn't). Not sure why it is behaving differently.

Formatting behaves like this in Eclipse:
keyword1 XXXX

keyword2 XXXX
keyword2 XXXX
keyword2 XXXX

keyword3 {
    | key    | value    |
    | -      | -        |
    | xx     | xx       |
}


But formats to this when formatting through the extension in Vscode:
keyword1 XXXX

keyword2 XXXX
keyword2 XXXX
keyword2 XXXX
keyword3 {
        | key    | value    |
| -      | -        |
| xx     | xx       |
}


keyword3 does not prepend an additional new line to separate from keyword2. It does format the table as expected, but over indents the first line and does not indent the rest.

Look forward to hearing any feedback!
Re: Vscode extension formatting has different behavior than Eclipse [message #1852939 is a reply to message #1852922] Sat, 11 June 2022 17:12 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14285
Registered: July 2009
Senior Member
I propose to debug if there are differences in the text edits calculated for eclipse and vscode

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:JvmUnknownTypeReference for Support Class
Next Topic:Xtext 2.26 based Maven build failing since 2022-06-15
Goto Forum:
  


Current Time: Thu Jun 30 23:32:19 GMT 2022

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

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

Back to the top