|Re: problem with using import quickfix [message #1745289 is a reply to message #1745133]
||Fri, 07 October 2016 10:33
| Stephan Herrmann
Registered: July 2009
I believe there's a general problem with serialization on behalf of a quick fix:|
Xtext determines the region that has to be replaced as the parent EObject of the current modification.
In case of an import this is always the entire model, i.e., we can only modify the list of imports in error-free models.
A smarter algorithm could instead identify the parent feature, here the list of imports.
Rewriting only this list could work independently of any problems in the rest of the model.
This reminds me of the JDT concept of distinguishing between the main ASTRewrite and individual ListRewrites.
(I'm aware that grammars exist, that populate a semantic list from various locations in the syntax,
but for "well-behaved" grammers that define a single (myFeature+=SomeRule)* assignment,
a list like 'myFeature' could be serialized as one isolated region of the text, without touching the rest)
If Xtext would support more fine grained rewriting, model based quick fixes would be much more powerful.
Currently it seems, that a quick fix can only resolve a single problem in a file.
If multiple problems exist, many quick fixes will simply fail, or even worse: discard data.
Are there any plans to improve Xtext in this direction?
Disclaimer: I'm discussion this at the state of 2.8.4, not sure if subsequent version have already improved on this issue.
Powered by FUDForum
. Page generated in 0.01690 seconds