Closed steve-hickman-epistimis closed 1 year ago
@steve-hickman-epistimis Thank you for reporting. Grammar Mixins are not very well supported in Xtext2Langium, so I'am very glad to see your feedback here!
However, when I generate from the Uddl grammar, I get only Uddl.langium
I would expect at least to see Terminals.langium. Hard to say what is going on without be able to see your project setup.
in Face.langium results in the following error: Inferred and declared versions of type 'ConceptualView' both have to be interfaces or unions
That is a know validation issue in Langium. However ConceptualView infers ConceptualView:
should be ConceptualView returns ConceptualView:
, then import 'Uddl-types'
should work.
You are not using generated ecore models, right? Are you using Xcore or Genmodel? Is it possible to look into you Languages setup? Or maybe you can create a small reproducible example and share it?
I am using generated ecore - via Genmodel. The Language section from the MWE2 file is:
language = StandardLanguage {
name = "com.epistimis.uddl.Uddl"
fileExtensions = "uddl"
fragment = io.typefox.xtext2langium.Xtext2LangiumFragment {
outputPath = './langium'
}
// rename refactoring
fragment = refactoring.RefactorElementNameFragment2 {}
fragment = org.eclipse.xtext.xtext.generator.ui.codemining.CodeMiningFragment {}
serializer = {
generateStub = false
}
validator = {
composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
// Generates checks for @Deprecated grammar annotations, an IssueProvider and a corresponding PropertyPage
generateDeprecationValidation = true
generateStub = true
}
formatter = {
generateStub = true
generateXtendStub = true
}
generator = {
generateXtendStub = true
generateJavaMain = true
}
junitSupport = {
junitVersion = "5"
}
fileWizard = {
generate = true
}
projectWizard = {
generate = true
}
}
I am planning to FOSS the repo this weekend if all goes well so you'll be able to see the whole thing at that point. Just gotta clean it up, add licensing, etc. first.
See the public repos here: https://github.com/Epistimis
@steve-hickman-epistimis Great, thanks! I will try it out this week
@steve-hickman-epistimis
Imported metamodels, even if they were generated in super language, were treated as referenced metamodels which leads to the behavior you described. In your projects there should be any *.xyz-types
files as they are all inferred.
I solved the problem in master. Will try to release a new version today.
I have several XText grammars with dependencies as follows:
When I generate from the Privacy grammar, I get the following files:
However, when I generate from the Uddl grammar, I get only
It isn't clear why this inconsistency exists.
Also - it appears that the
in Face.langium results in the following error:
ConceptualView
is defined in my Uddl.xtext grammar as:Uddl.langium
contains:Uddl-types.langium
contains:Removing
import 'Uddl-types'
fromFace.langium
appears to correct that problem.