quick fix (ISemanticModification) for file with errors? [message #895965] |
Mon, 16 July 2012 12:39  |
Eclipse User |
|
|
|
I have the simplest of quick fixes which just adds one line at the top of a file. I used an ISemanticModification (although this particular use case might be better served with a plain IModification). Unfortunately this quick fix fails if the file contains a syntax error.
The element added by the quick fix corresponds to a field of the root model EObject. Thus, the change is recognized as changing the root object, thus the entire file is being serialized, which throws IConcreteSyntaxValidator.InvalidConcreteSyntaxException on any syntax error in the file, thus aborting the modification.
Is there a way the quickfix could signal to the framework that some regions are not affected by the change? Or are semantic modifications of files with errors out of scope ATM?
Would you be interested in a discussion of how the JDT addresses similar problems?
best,
Stephan
|
|
|
|
|
|
|
|
|
Re: quick fix (ISemanticModification) for file with errors? [message #899722 is a reply to message #897103] |
Thu, 02 August 2012 02:12  |
Eclipse User |
|
|
|
Hi Stephan,
On 7/21/12 9:55 PM, Stephan Herrmann wrote:
> Do URI fragments change even if the resource containing the target of the
> x-ref is not changed at all?
>
No, not if the reference could be resolved. Then there should in fact, under
normal circumstances, not be any proxies with URIs in play at all.
This is different when there are unresolved references. These are represented
by lazy linking proxies whose URI depends on the owning object's location in
the resource (relative to the root). The lazy linking proxy URI may thus
become invalid when changing the model and would then result in exceptions
during serialization.
> If so, this might well explain that part of the problem. I'd be happy to try
> the patch from the bug once it appears in a public build. Is it ready for a
> test drive?
>
The patch has not been committed. You would have to apply it in your own code
base by making corresponding Guice bindings.
> What about serializing a document with syntax errors? Is that somehow supported?
>
What is being serialized is the model and as such can't really contain any
syntax errors. The model can although contain semantic errors which may or may
not prevent serialization.
Regards,
--knut
|
|
|
Powered by
FUDForum. Page generated in 0.05206 seconds