Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Fomratting won't work correctly when save xtext resource programmatically AbstractFormatter2(Fomratting won't work correctly when save xtext resource programmatically AbstractFormatter2)
Fomratting won't work correctly when save xtext resource programmatically AbstractFormatter2 [message #1854107] Mon, 01 August 2022 15:02 Go to next message
Nagaraj Kandoor is currently offline Nagaraj KandoorFriend
Messages: 56
Registered: May 2020
Member
When I try to save xtext resource programmatically formatting won't work correctly? if I apply manual formatting from editor it works.

We are extending AbstractFormatter2.
Before saving i move few object in emf and save.
Do semantic model differ when we save resource programmatically?

Any input will be appreciated.


Thanks
Nagaraj
Re: Fomratting won't work correctly when save xtext resource programmatically AbstractFormatter2 [message #1854109 is a reply to message #1854107] Mon, 01 August 2022 15:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
in doubt it is a bug. can you provide a reproducing unit test?
did you compare if the textedits calculated are the same?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Fomratting won't work correctly when save xtext resource programmatically AbstractFormatter2 [message #1854111 is a reply to message #1854109] Mon, 01 August 2022 15:27 Go to previous messageGo to next message
Nagaraj Kandoor is currently offline Nagaraj KandoorFriend
Messages: 56
Registered: May 2020
Member
@Christian Dietrich Thank you quick reply I did some comparison i found slight difference but why its happening not sure.

Basically what i was trying to do was , move few object from one container to other container and save programmatically.

PFA of report. Left hand side is manual formatting and right hand side is save programmatically(ITextReplacers).

In our formatter if we see anything - we append few spaces.

Formatting works through editor, but not with programmatic save.

Thanks
Nagaraj

[Updated on: Tue, 02 August 2022 11:00]

Report message to a moderator

Re: Fomratting won't work correctly when save xtext resource programmatically AbstractFormatter2 [message #1854113 is a reply to message #1854111] Mon, 01 August 2022 16:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
it looks like saving formats only the changed regions and not the complete file
also check what is the diff between the FormatterRequests the formatter is called with in both cases
=> would be nice to have a reproducing unit test


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 01 August 2022 17:03]

Report message to a moderator

Re: Fomratting won't work correctly when save xtext resource programmatically AbstractFormatter2 [message #1854123 is a reply to message #1854113] Tue, 02 August 2022 07:36 Go to previous messageGo to next message
Nagaraj Kandoor is currently offline Nagaraj KandoorFriend
Messages: 56
Registered: May 2020
Member
@Christian Dietrich Thank you, will check FormatterRequest for both manual and programmatic save.
Re: Fomratting won't work correctly when save xtext resource programmatically AbstractFormatter2 [message #1854217 is a reply to message #1854123] Mon, 08 August 2022 09:31 Go to previous message
Nagaraj Kandoor is currently offline Nagaraj KandoorFriend
Messages: 56
Registered: May 2020
Member
RCA was when i was saving resource I was not passing save option map with explicitly stating formatting, though the formatter get called but it was not getting formatted correctly.
val saveOption = SaveOptions.newBuilder.format.options.toOptionsMap.

@Christian Dietrich Thank you
Previous Topic:can we invoke IFormatter2 through context menu?
Next Topic:Xtext spelling not working on camel case words
Goto Forum:
  


Current Time: Thu Apr 25 17:14:47 GMT 2024

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

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

Back to the top