0
我正在開發一個DSL,它重用在另一個DSL中定義的類型。基本上我有兩個文件擴展名,比如說.A和.B,一些實體在.A中聲明,我需要在.B中訪問它們。我使用importURI只能訪問我需要的引用.A。xtext importURI引用無法解析
代碼完成工作完美,它給了我在.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 {}
感謝
你能分享語法和樣本模型嗎? ,你應該刪除 fragment = scoping.ImportNamespacesScopingFragment auto-inject {} –