我正在开发一种DSL,它可以重用另一种DSL中定义的类型。基本上我有两个文件扩展名,让我们说.A和.B,一些实体在.A中声明,我需要在.B中访问它们。我使用importURI只能访问我需要的引用.A。
代码完成工作完美,它为我提供了.A中声明的实体,但问题是我看到错误消息说无法解析引用。
我已完成与此帖xtext importURI external file中建议相同的事情,以下是我的工作流程片段:
// Java API to access grammar elements (required by several other fragments)
fragment = grammarAccess.GrammarAccessFragment auto-inject {}
// generates Java API for the generated EPackages
fragment = ecore.EMFGeneratorFragment auto-inject {}
// the old serialization component
// fragment = parseTreeConstructor.ParseTreeConstructorFragment auto-inject {}
// serializer 2.0
fragment = serializer.SerializerFragment auto-inject {
generateStub = false
}
// a custom ResourceFactory for use with EMF
fragment = resourceFactory.ResourceFactoryFragment auto-inject {}
// The antlr parser generator fragment.
fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject {
// options = {
// backtrack = true
// }
}
// Xtend-based API for validation
fragment = validation.ValidatorFragment auto-inject {
composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
// old scoping and exporting API
fragment = scoping.ImportURIScopingFragment auto-inject {}
// fragment = exporting.SimpleNamesFragment auto-inject {}
// scoping and exporting API
fragment = scoping.ImportNamespacesScopingFragment auto-inject {}
fragment = exporting.QualifiedNamesFragment auto-inject {}
//fragment = builder.BuilderIntegrationFragment auto-inject {}
// generator API
//fragment = generator.GeneratorFragment auto-inject {}
// formatter API
//fragment = formatting.FormatterFragment auto-inject {}
// labeling API
//fragment = labeling.LabelProviderFragment auto-inject {}
// outline API
//fragment = outline.OutlineTreeProviderFragment auto-inject {}
//fragment = outline.QuickOutlineFragment auto-inject {}
// quickfix API
fragment = quickfix.QuickfixProviderFragment auto-inject {}
// content assist API
fragment = contentAssist.ContentAssistFragment auto-inject {}
// generates a more lightweight Antlr parser and lexer tailored for content assist
fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {}
// generates junit test support classes into Generator#pathTestProject
//fragment = junit.Junit4Fragment auto-inject {}
// rename refactoring
//fragment = refactoring.RefactorElementNameFragment auto-inject {}
// provides the necessary bindings for java types integration
//fragment = types.TypesGeneratorFragment auto-inject {}
// generates the required bindings only if the grammar inherits from Xbase
//fragment = xbase.XbaseGeneratorFragment auto-inject {}
// provides a preference page for template proposals
//fragment = templates.CodetemplatesGeneratorFragment auto-inject {}
// provides a compare view
//fragment = compare.CompareFragment auto-inject {}
由于
答案 0 :(得分:0)
感谢Christian,通过重新生成默认的.mwe2并对这两个片段进行评论来实现它的工作
//generates the required bindings only if the grammar inherits from Xbase
//fragment = xbase.XbaseGeneratorFragment auto-inject {}
//provides a preference page for template proposals
//fragment = templates.CodetemplatesGeneratorFragment auto-inject {}