Quickfix and format problem

I am reading from the book "Implementing DSL with xtext and xtend" it says that formatter is invoked when of course the Format from the context menu is used or the shortcut for it "Ctrl + Shift + F" is used. It also says that "If you provide a custom formatter this will be used not only when the format menu is invoked but also when xtext needs to update the editor contents after a manual modification of the AST model( for example a quickfix performing a semantic modification".
With that said I am having a problem that when my quickfix is invoked the formatter doesn't get invoked resulting in a terrible looking text.
Example:
----1-----
---Text before quickfix---
entity myentity {
FooBar s;
} entity second{}
----2-----
---Quickfix add unimplemented entity---
entity myentity {
FooBar s;
} entity FooBar {
} entity second{}
----3-----
---invoking the formatter MANUALLY(How it should look like)---
entity myentity {
FooBar s;
entity FooBar {
entity second {
QuickFix implementation:
@Fix(Diagnostic::LINKING_DIAGNOSTIC)
def CreateMissingEntity(Issue issue, IssueResolutionAcceptor acceptor)
acceptor.accept(issue,"Create missing entity.","Create missing entity.", "" ,
[element, context |
val currentEntity = element.getContainerOfType(typeof(Entity))
val model = currentEntity.eContainer as Model
model.entities.add(model.entities.indexOf(currentEntity)+1, EntitiesFactory::eINSTANCE.createEntity() => [name = context.xtextDocument.get(issue.offset,issue.length)])
Formatter implementation:
@Inject extension EntitiesGrammarAccess g
override protected void configureFormatting(FormattingConfig c) {
// It's usually a good idea to activate the following three statements.
// They will add and preserve newlines around comments
//entitites
val e = g.entityAccess
// indentation between {}
c.setIndentation(e.leftCurlyBracketKeyword_3,e.rightCurlyBracketKeyword_5)
// newline after {
c.setLinewrap.after(e.leftCurlyBracketKeyword_3)
// newlines after }
c.setLinewrap(2).after(e.rightCurlyBracketKeyword_5)
//attributes
val a = g.attributeAccess
// newline after ;
c.setLinewrap.after(a.semicolonKeyword_2)
// remove spaces before ;
c.setNoSpace.before(a.semicolonKeyword_2)
c.setLinewrap(0, 1, 2).before(SL_COMMENTRule)
c.setLinewrap(0, 1, 2).before(ML_COMMENTRule)
c.setLinewrap(0, 1, 1).after(ML_COMMENTRule)
I have been searching a lot if the formatter is actually invoked as the book says after a quickfix but found nothing. Is this real? and if not how can I invoke the formatter programmatically from the quickfix code.

On 16/06/2015 16:09, ayman salah wrote:
> I am reading from the book "Implementing DSL with xtext and xtend" it
> says that formatter is invoked when of course the Format from the
> context menu is used or the shortcut for it "Ctrl + Shift + F" is used.
> It also says that "If you provide a custom formatter this will be used
> not only when the format menu is invoked but also when xtext needs to
> update the editor contents after a manual modification of the AST model(
> for example a quickfix performing a semantic modification".
>
> With that said I am having a problem that when my quickfix is invoked
> the formatter doesn't get invoked resulting in a terrible looking text.
> Example:
>
> ----1-----
> ---Text before quickfix---
>
> entity myentity {
> FooBar s;
> } entity second{}
>
> ----2-----
> ---Quickfix add unimplemented entity---
>
> entity myentity {
> FooBar s;
> } entity FooBar {
> } entity second{}
>
> ----3-----
> ---invoking the formatter MANUALLY(How it should look like)---
> entity myentity {
> FooBar s;
> }
>
> entity FooBar {
> }
>
> entity second {
> }
>
> QuickFix implementation:
> @Fix(Diagnostic::LINKING_DIAGNOSTIC)
> def CreateMissingEntity(Issue issue, IssueResolutionAcceptor acceptor)
> {
> acceptor.accept(issue,"Create missing entity.","Create missing
> entity.", "" ,
> [element, context | val currentEntity =
> element.getContainerOfType(typeof(Entity))
> val model = currentEntity.eContainer as Model
>
> model.entities.add(model.entities.indexOf(currentEntity)+1,
> EntitiesFactory::eINSTANCE.createEntity() => [name =
> context.xtextDocument.get(issue.offset,issue.length)])
> ]
> );
> }
Hi there
If I remember correctly that behavior changed a few Xtext versions ago,
I'm afraid. At the time of writing the book it used to work like that :)
Please, also note that since Xtext 2.8 a new formatting mechanism has
been introduced that's completely different (and better :); that's
specified in the ERRATA of the book in the github repository.
cheers
Lorenzo
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book

Similar Messages

  • Creative Zen 4 Gb Rebuilding and Format Problem

    i have creative zen 4 gb mp3 player. eveytime when i was opening the device, it is rebuilding player and then it opens. Also i tried to format all my player in recovery mode and it is formatted.After format when i was opening device again, it was rebuilding and then everything is come back. i cant copy new files to my device. only i can listen what was in it.
    Please help my problem, what should i do?

    Please try formatting your player using the Creative Media Explorer software.
    . Connect your player to your computer's USB port using the supplied USB cable.
    2. Double-click the My Computer icon on your desktop.
    3. Click the ZEN Media Explorer icon.
    4. Click the Settings and Information button and click the Tools tab.
    5. Click the Format button.
    If it's still not working, you probably need to contact Customer Support for further assistance.

  • Creative sound blaster Z Khz and Format problems giving no more sound

    Hi there.
    First off let me say that i know little to none about audio, so i'm not a audiofile.
    Second i have some qeustions/problems with mij Creative z soundblaster and hoped someone else has tackeld these problems and is willing to teach how to setup this sound blaster.
    I'm using a Creative soudblaster z that is hooked up thourgh a toshlink cable to mij Logitech speaker set (z550) and till today al was working just fine!
    But i recently read something about the (i hope i say this right) Sample rates or KHZ that can improve mij Sound quality, so i read thath the blaser z can handle up to 128 Khz or something... so i thought let's give that a try!
    So in windows when right click on the speaker icon i got to playback devices and there i find 2 icons a SPDIF- Out and the Speakers icon of the creative z sound blaster.
    So i went to Speakers and changed the Default format( default is 24bit, 48000) to 24 Bit, 96000 (Hz studio quality).
    After this change i rebooted the computer and after the reboot al sounds where working!
    So after that i decided to got The Spdif-out and go to the Supported formats page, here i unchecked the 48.0 Khz box and checked the 96.0 Khz box.
    Also under Advance i changed the default format to 2 channel, 24 Bit, 96000 HZ.
    Now when i pres the test button EVERYTHING WORKS, when i run the windows speaker setup thiny al 5.1 speakers react the way they supposed to react.
    But when playing music or video there is no sound!
    Everytime i reboot windows and start up Aimp to listen to some music, the music wil play but there is no sound! When aimp is playing and i w8 for like 5 to 10 minuts the Decoder light on mij speaker console will light up and then i will hear sound!
    Normaly when i reboot windows the decoder light starts glowing imediatly now i either must w8 (this might tak hours somethime) or i go the sounds configuration and after pressing let's say 20x time the test souns button the sound start working for no reason!
    So is there anyon who has these problems (oh yeah deinstalled and reinstalled driver 4 time by now so it aint the driver or mij speaker because mij ps3 aswel as mij ps4 work properly and do give me sound) or better yet know how to resolve this isseu!
    Or did i not configurate the sound settings well ? please inform how i need to set them.
    And oh yeah Like i said i'm no audiofile, but as far as i understand the BOX the creative z comes in, it tells me i can go up to 128 KHZ so... the 98khz Should not be the problem, the sound card should be able to do this ? right !?
    So for everyone who read tis post Thank you for tanking the time to read it!
    For those who replyed even more thanks
    ooh yeah before i forget, if the post is a bit unclear for you pls don't hessitate to contact me or sent me mail for a more or better explenation of the problem, if you need aditional info PLS say so and i will post it

    Set your SPDIF to default settings. The Logitech speakers will be doing all of the work DECODING what you are outputting to it with your sound card. The SPDIF is strictly digital. The setting in your "speaker" option sets up the Analog to digital conversion bit depth and sample rates. With dolby digital and DTS connect though those will output at 16 bit, 48 khz. If you were connecting to your logitech speakers with the three analog cables (green-front left and right, Black-rear left and right, and yellow-center and surround) then your setting choices in the 'speakers" applet of control panel, sounds would have an effect on downsampling, upsampling, and output quality.
    Lastly, make sure to right click on the Speakers icon in the sound control panel applet and choose "set as default."

  • Exporting and format problems

    On my pc, I downloaded the trail version of adobe audition. I have been unable to successfully export my creation onto a cd.
    I have tried everything. It simply wont allow me to export it from audition. The button doesn't work. Also, when I save it in a different format, the audio is not there.
    Thanks for the help...

    Perhaps you could tell us a bit more about exactly how you're trying to burn the CD and what (if any) error messages you get.  One quick thing to mention is that Audition only does audio CDs (not data CDs) and therefore will only burn if your files are 16 bit/44.1kHz sampling/Stereo files.
    Similarly, when you say "the audio is not there" what exactly do you mean?  Is there a waveform displayed that you don't hear, or is there sound but no waveform display...or just nothing?
    Finally, some details of what you're using (Mac/Windows, what sound card, etc.) is always useful.

  • IWeb08 "Add Comments" and Format Problems

    Morning!
    I've been having problems with getting "Add Comments" to appear when publishing my site. I've read that iWeb08 folks get problems when publishing a non-Mobile Me site. All of the solutions I've googled seem to be outdated, such as signing up for "Haloscan," which seems to not exist anymore. I was wondering if anyone had any remedies?
    Also, for whatever reason the spacing seems to get slightly messed up upon publishing. Notice on this post: http://healthydayfitness.com/Blog/Entries/2011/2/14FirstPost.html that the title and date are "scrunched up" with the text.
    This post: http://healthydayfitness.com/Blog/Entries/2011/2/14Cleveland_Clients_%26_We_Run_ThisCity.html cuts the email address off of the bottom.
    I've double checked my iWeb work, and it looks perfect there. I've tried deleting and re-uploading several times to no avail.
    Any help would be greatly appreciated.
    Cheers!
    Joe B

    Joe ~ If you're not publishing to MobileMe, an alternative to Haloscan is suggested here:
    http://iwebfaq.org/site/iWebFeedbackComments.html
    But as problems with iWeb's blog are a constant theme on these forums, it's often recommended to use a dedicated blogging platform instead of iWeb's, e.g.
    http://posterous.com
    http://wordpress.com

  • I had a problem with the hard disk on a 2010 macbook pro. Replaced the hard disk with an Hitachi 1TB and when I tried to erase and format It fails with input/output error. Any help much appreciated!

    I had a problem with the hard disk on a 13" 2010 macbook pro. Replaced the hard disk with an Hitachi 1TB disk but when I tried to erase and format, it fails with input/output error and at other times saying unable to allocate memory. Any help much appreciated!

    Zap the PRAM and Reset the SMC, then try again.

  • After a startup problem with my macbook pro i put it as slave and formatted the internal Hard drive. Now i want to install OS X Mavericks from USB

    After a startup problem with my macbook pro i put it as slave and formatted the internal Hard drive. Now i want to install OS X Mavericks from USB
    How can i do that?

    What did you "put as slave?" What Mac model do you have, exactly?

  • I am exporting a pages doc to ePub and I keep getting formatting problems any idea thx in advance

    I am exporting a pages doc to ePub and I keep getting formatting problems any idea thx in advance

    Since you don't say what the "formatting problems" are, all we can say is:
    "There, there. Hope they get better."
    Peter

  • Thank you for approving my feed iTunes . The only problem is, there is no art work, even though artwork was submitted correct sizes and formats were used. Why is this and how can the problem be rectified?

    Thank you for approving my feed iTunes . The only problem is, there is no art work, even though artwork was submitted correct sizes and formats were used. Why is this and how can the problem be rectified?

    Thanks for getting back. Hadn't got round to re uploading the amended feed. I just did it now.
    The only thing is, Feed Validator doesn't like it because of the picture size, and a couple of other things, it reeds the following:
    Sorry
    This feed does not validate.
    line 22, column 14: width must be between 1 and 144: 1400 [help] <width>1400</width>
                  ^
    line 23, column 15: height must be between 1 and 400: 1400 [help] <height>1400</height>
                   ^
    line 25, column 21: XML parsing error: <unknown>:25:21: not well-formed (invalid token) [help]
    <itunes:image href=http://www.whiteberg.com/Wdotfontitunes2.png" />
                         ^
    In addition, interoperability with the widest range of feed readers could be improved by implementing the following recommendations.
    Your feed appears to be encoded as "utf-8", but your server is reporting "US-ASCII" [help]
    line 4, column 114: Self reference doesn't match document location [help]... dcast.xml" type="application/rss+xml" />
                                                 ^

  • Whatsnew page for 3.6.17 has formatting problems with Firefox and I.E.

    I just updated from 3.6.16 to 3.6.17n and the whatsnew page, displayed after Firefox restarted, has formatting problems in the lower right hand corner.
    I checked it with I.E. 8 and it also shows the formatting problem.
    Why wasn't this caught before the page was put into "production"?
    The URL is http://www.mozilla.com/en-US/firefox/3.6.17/whatsnew/
    There is a line with the text "Release Notes » Firefox Features » Firefox Help »" that is being displayed on top of other material.
    I wonder what a new Firefox user or an inexperienced user would think of this? They might think that they did something wrong or, worse, they might consider Firefox had problems and they won't use it.
    This reflects badly on Firefox.
    One more thing, could someone make this textarea taller and wider. It is so small as to cause problems typing and proofing the material.
    The URL is https://support.mozilla.com/en-US/questions/new?product=desktop&category=d6&search=whatsnew+page+for+3.6.17+has+formatting+problems+with+Firefox+and+I.E.&showform=1
    How about upping the cols and rows values? They are currently rows="10" cols="40"

    As you have a Power Mac you also have a alternative option to consider which is a third-party build from http://tenfourfox.blogspot.com/2011/08/601-now-available.html

  • I have problem i delete recovary drive and format c drive now

    i have problem i delete recovary drive and format c drive now not work totaly my computer what i do

    If you did not create recovery disks when you got the computer, you may order them.
    If you live in the USA/Canada, call HP at this number 1-800-334-5144, and see if you can still get a set of recovery disks.
    Otherwise via the WorldWide Site:
    http://welcome.hp.com/country/w1/en/support.html
    Please mark my post as SOLVED if it has resolved your problem. It helps others with similar situations.

  • Ipod Nano formatting and installation problems

    [IMG]http://i4.photobucket.com/albums/y111/niedec/screen.jpg[/IMG] I get this screen every time I try to install and format my iPod Nano using the included software. What should I do?

    Hi niedec,
    For starters, download the latest iTunes and iPod Updater from Apple. Chances are that they are more up-to-date than the software you got on CD:
    <a href=http://www.apple.com/ipod/download/">Get iPod Updater</a>
    <a href="http://www.apple.com/itunes/download/">Download iTunes 6
    maz

  • Data Recovery from Partitioned and formatted Bit Locker Encrypted Drive

    Recently because of some issues in windows 7 installation from windows 8 installed OS. it was giving as the disc is dynamic windows can not be installed on it. so at last after struggling hard no other solution i partitioned and formatted my whole
    drive so all data gone included the drive which was encrypted by bit lockers.
    For recovery i used many software such as ontrack easy recover, get data back, recovery my files professional edition but still i couldnt able to recover my data from that drive. then i found some suggestion Using CMD to decrypt my data first 
    http://technet.microsoft.com/en-us/library/ee523219(WS.10).aspx
    where it shows it successfully decrypt my data at that moment my drives were in RAW format excluding on which windows is installed and then in CMD i check Chdsk which also shows no problem found. but now problem is still i coudnt able to recover
    my data then i format the drive D and again tried to recover data using above software after decryption still no result. 
    Now i need assistance how i can recover my encrypted drive as it was partitioned and also formatted but decrypted also as i have its recovery key too. thanks

    Hi ,
    I am afraid that we cannot get the data back if the drive has been formatted even if use the
    BitLocker Repair Tool.
    You’d better contact your local data recovery center to try to get data back.
    Tracy Cai
    TechNet Community Support

  • Few questions about partitioning and formatting in Windows 8

    Hello,
    I'm very shortly after a Windows 8 reinstall and I want to make use of this moment to finally understand partitioning and formatting in Windows 8.
    Before using Windows 8, I was an XP user for 5 years and I actually never bothered myself with formatting my main system partition, that's probably why my computer ended up working like a slime for the last years. Anyway, by now I have been using Windows 8 for a year.
    Three weeks ago I faced a system-related problem with my laptop (IdeaPad Y580) which prevented it from peacefully shutting down. A good friend of mine (XP user for his entire life, and now Windows 7 newbie user) told me, that I should keep all my non-system stuff on separate partition and that I should do the main system partition format from time to time to keep my PC out of trouble. It is sure that he took his knowledge from using XP, and here's my first question - does this method apply to Windows 8?
    I mean as far as I know, back then, in XP, partitioning was possible only during Windows installation, and now, in Windows 8 we have a Disk Management for this, which do not require running Windows installation to create new partitions.
    I'm mentioning this due to the fact that originally (I mean by factory settings) my drive has only one visible partition - C: (1TB), so I would need to use the Disk Management to take some space from C: partition and allocate it to the new D: partition.
    In case I do this whole partitioning operation and create a D: partition, is it sure that formatting my system-only C: partition won't have effects on my D: partition, and all the programms and data I have here will stay on their places and work after format? (I'm worried about this because I've seen in some partitioning guide a warning not to format the main partition after the partitioning operation, because it would erase totally all data - I'm not sure if I misunderstood something or is it a mistake? EDIT: here's the link for this guide, just jump to the "Final Thoughts" section to see what I'm taking about: http://www.technorms.com/8438/windows-8-create-hard-drive-partition ).
    If this whole method of keeping your system running fine doesn't apply to Windows 8, I guess I'm okay with having only one C: partition.
    By the way, it doesn't matter for me if I create new partition in terms of conflicts with preinstalled Lenovo OneKey Recovery, since I had to reinstall my Windows 8 recently from non-Lenovo CD, and either way my laptop is now totally clean, without Lenovo stuff (I found Lenovo Recovery CD for Y580 on the internet, but it had non-single-language Windows 8 in it, and I needed a single-laguage one in order to have my Product Key recognised, so I just used a pure Windows 8 SL installer)

    I just found out that I can't even transfer my Users folder or Program Data to other drive than the one with the system, because it would prevent me from updating my system or even from actually booting to my system. So apparently my whole topic is for nothing... I guess I should live with only one drive, and whenever my system totally crashes again I should do the backups to my external HDD. It's sad though that Windows 8 is a total opposite to user-friendly OS, to say the least.

  • Thunderbolt partitioned and formatted hard drive not recognized on USB2/3

    I have a MBA (mid 2012) and recently purchased a Seagate Desktop Thunderbolt Adapter (STAE129), a Seagate Backup Plus 4TB USB 3.0 external drive (STCA4000100), and Apple Thunderbolt cable. The 4TB hard drive can be separated from the USB 3.0 adapter and the drive placed on the Thunderbolt adapter. I created two partitions (3TB and 1 TB) on the 4TB drive while it was mounted on the Thunderbolt adapter and formatted them Mac OS Extended (Journaled) using partition map scheme GPT. Everything works as expected, the drive hits r/w speeds in the 180 MB/s range (using Blackmagic Disk Speed Test), and no issues at all transferring data to the 3TB partition and using the 1TB partition for TimeMachine.
    However, if I disconnect the hard drive from the Thunderbolt adapter and place it on the USB 3.0 adapter and connect it to my MBA, Mountain Lion says "The disk you inserted was not readable by this computer and gives me the options to Initialize, Ignore, or Eject. Going into Disk Utility app, the drive shows up without the partitions I created when the same drive was mounted to the Thunderbolt adapter (just shows disk1s1). In fact, the drive label (Disk Description) is different too and the Partition Map Scheme now shows MBR!
    To try work-arounds, I went ahead and repeated the partitioning and formatting steps with the drive attached via USB 3.0 and all works fine until I put the drive back on the Thunderbolt adapter where once again OSX reports that the disk is not readable. I've even tried a single partition with no luck. In short, the drive partitioned and formatted on Thunderbolt is unrecognized under USB and vice versa.
    Shouldn't the disk preparation and data be consistent across these different interfaces? I would think so. My biggest concern is that if I had a failure in the Thunderbolt setup (assuming the drive itself does not fail), then I can't access my data. This is not a very comfortable situation.
    I'm assuming I've overlooked a very basic detail. Appreciate any steer to solve this problem.
    Thanks,
    Rob

    Thanks for that, I recently ran into the same problem. I even chatted with Seagate tech support and they didn't know the answer.
    My situation is a bit different from you. I bought the 3 TB Thunderbolt version of the drive directly and then purchased a USB 3 adaptor seperately.  You see, I still own a 3 year old Macbook Pro that doesn't come with a Thunderbolt port. I was looking to upgade to a MacBook Air later.  I thought that I might as well buy the TB version now.
    In anycase, my old MacBook Pro won't see the drive when I use the USB3 adaptor. I get the same exact error message as you did. I can't really test it on Thunderbolt since I don't have one.  I'm going to go install the Thunderbolt drivers now and hopefully, it will recognize the drive afterwards.  I'll let you know what happens.
    BTW, I was thinking of reformatting the drive with NTFS so that I can use the drive on PCs. My mac has the NTFS drivers loaded so it's no problem. I hope this won't screw up the Thunderbolt connection later when I do get the Macbook Air?

Maybe you are looking for