|
|
|
Re: Building the index in Eclipse for non-Java projects? [message #1818862 is a reply to message #1818811] |
Tue, 31 December 2019 05:08 |
Marc-André Laperle Messages: 256 Registered: July 2009 |
Senior Member |
|
|
Hi Christian, thanks a lot for your help! So the first mistake I made was that I misconfigured the "extensions" field in the Xtext project wizard, I had "jsondsl" as it was also the name of my prototype language and I probably thought I'd start with that and change it later. But I ended up testing with .json files. Then I was working backwards to fix this by trying to binding things manually. Then another mistake was that I misinterpreted ToBeBuiltComputer.isHandled:
boolean possiblyManaged = contribution.isPossiblyHandled(storage);
if ((possiblyManaged || storage instanceof IFile) && uriValidator.isPossiblyManaged(storage)) {
For non-Java projects it falls in the "storage instanceof IFile" branch and it's "uriValidator.isPossiblyManaged(storage)" that's actually the culprit. Then I noticed that the registry's extensionToFactoryMap only contains jsondsl as a key and not json. Since you seem to imply that what those cross-references should work ootb without this kind of modification, I grew suspicious. I noticed in the .mwe2 file that I could change fileExtensions to "json" instead of "jsondsl", then I did a "Generate Language Infrastructure" again. Surprisingly, that turned out to not regenerate everything and the UI plugin's plugin.xml still contains mentions of "jsondsl" as file extension, among others. In fact, then I tried to run, I got exceptions such as:
org.eclipse.xtext.builder.resourceloader.IResourceLoader$LoadOperationException: org.xml.sax.SAXParseExceptionpublicId: platform:/resource/testdsl/test.json; systemId: platform:/resource/testdsl/test.json; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
at org.eclipse.xtext.builder.resourceloader.SerialResourceLoader$1.next(SerialResourceLoader.java:50)
So, I ended up starting from scratch a new Xtext project and setting the "extensions" field correctly. Now it is working properly.
But I don't quite understand the proper workflow of Xtext with regards of code generation with mwe2, emf, xtend, etc. It doesn't make sense to me that I'd have to restart from scratch whenever I want to edit the language file extensions in mwe2, or perhaps I am not generating correctly... or perhaps it is expected to only generate once at the beginning and edit everything by hand after? Perhaps there is something in the documentation that I missed about that or you know of a good source of information that could clear this up for me? You have already helped me through my original problem so thanks a lot in any case!
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03143 seconds