Good day,
I am working on an xtext project. I have written xtend to transform "runtime DSL instance" into equivalent code (text file).
Now I want that when I change the generated code (text file) the same is reflected in the "runtime DSL instance"
Any guidelines please .... ?
Related
I have an XText project setup with multiple grammars and am able to edit each grammar with cross-linking within the IDE generated by the mwe2 workflow. When I run the example web editor, the first grammar defined in the mwe2 workflow functions correctly.
If I change the the generated index.html to use one of the alternate grammar extensions the editor no longer functions, and I get an error message that looks like:
Xtext service 'occurrences' failed: Unable to identify the Xtext
language for resource 3c05cdd1.ed
I'd like to understand what is wrong in order to better understand how I can begin minimal integration of editors for the grammars into our existing console.
Thanks!
Pierre Padovani
P.S. I've posted this same question on the Eclipse Community Forums, but my post seems to be stuck in a moderator queue.
Having found the thread which #ppadovani mentions, it seems that the only necessary change is to ignore all the generated Servlet.xtend files except the one whose grammar is working.
In that one which works, it is necessary to initialise run the WebSetup for the other languages.
override init() {
super.init()
// call createInjectorAndDoEMFRegistration for each WebSetup
new DerivedDslWebSetup().createInjectorAndDoEMFRegistration
// keep the rest as-is
val injector = new CoreDslWebSetup().createInjectorAndDoEMFRegistration()
disposableRegistry = injector.getInstance(DisposableRegistry)
}
Reference: https://www.eclipse.org/forums/index.php?t=msg&th=1096166&goto=1798287&#msg_1798287
Today I want to see scala source code using intellij,when I see HashMap class I found intellij has grammatical errors,scala source code must be correct,I want to know why intellij has grammatical errors here
It's show 'reassignment to val' error
I am working in project generated by the xtext project wizard.
On the the Internet there is a lot of examples but I cannot see in which project and the package name the code formatting class must be defined.
Must the class also be register?
PS my Java skills is not very good.
You can add a
formatter = {
generateStub = true
}
To the Workflow
I have a rather silly question. I am using xtext to define a simple dsl and Xpand to generate code.
Now I want to use xpand to read my dsl models and generate code. How can i do that?
I read lot of tutorials saying that I can simple do that by creating a new xtext project from the wizard. Then, among others, the following project will be created:
org.xtext.example.domainmodel.generator.
And inside, the generator looks like this:
src
model (place the dsl model)
templates (place the template for the code generator)
workflow (workflow file)
Then i simple run the workflow and generate the code from the dsl file. That s straightforwards and easy.
My problem is that when I create a new xtext project I dont get the org.xtext.example.domainmodel.generator. project. I only have the following four:
org.xtext.example.domainmodel
org.xtext.example.domainmodel.sdk
org.xtext.example.domainmodel.tests
org.xtext.example.domainmodel.ui
So how can i produce the org.xtext.example.domainmodel.generator file???
Which tutorials do you mean? (links please) And do they really talk about a generator project? Talking about the package org.xtext.example.domainmodel.generator inside the org.xtext.example.domainmodel project is the usual thing.
Probably not relevant to the original person who asked this :) but I had a similar problem and the reason was that in my grammar extended xbase.
When extending xbase building the mwe2 skips the generator stub generation and uses the xbase code generation which is generated instead (the antlr parser, serializer etc.)
In Eclipse CDT, I would like to create syntax highlighting and a error parser for a custom filetype, lets say *.xy.
Those files do not contain C-Code, so i cannot use any existing parsers.
What kind of plugins would I have to create?
For the error parser, I think I have to use Codan? (have not tried it yet)
https://www.ibm.com/developerworks/java/library/j-codan/
The CDT is the wrong start for your journey, if your language is not related to the CDT supported languages and workflows. Implement an xtext based language editor instead.
Maybe this is a simple solution for you:
colorEditor plugin
You can simply add a new language by unpacking the jar archive, then adding a xyz.xml file for your .xyz files.
Pakc together again, and copy into your Eclipse "plugins" dir.
You need to introduce a new "language" - this is the extension point: http://help.eclipse.org/helios/topic/org.eclipse.cdt.doc.isv/reference/extension-points/org_eclipse_cdt_core_language.html
Codan is not an "error parser" it is a static analysis framework. Error parser processes output of the command-line tools you use to build the application (e.g. compiler, linker) to identify errors that happened during the build and filling their attributes, e.g. source file name and line number.
Codan analyzes the source code in the editor to identify errors. E.g. it checks if the variable used in the expression was declared beforehand. Note that same check can be performed by a compile at a build time and then captured by error parser and shown in the editor/problems view - the goal of Codan is to detect problems sooner, before the build is even ran. Codan can also perform some checks that compiler doesn't.