| Summary: | [xtext][grammar] Grammar's qualified name in index contains only one segment | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Johan Wannheden <johan.wannheden> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | germund, sebastian.zarnekow |
| Version: | unspecified | Flags: | sebastian.zarnekow:
indigo+
|
| Target Milestone: | SR2 | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
See XtextQualifiedNameProvider. Simplest workaround if you want to link to an Xtext grammar: Override DefaultLinkingService#getLinkedObjects and query the scope with a hand-made qualified name when the grammar should be resolved. Downside: Imports don't work. Since this is the first complaint on the wrong exported name, I assume that other languages, that refer to a grammar, use classpath uris to load it (e.g. code templates or Xtext itself). I'll fix the exported name and won't export a grammar instance twice. Any objections? Pushed to master. The problem Johan described is still reproducible with Xtext 2.2.1. (In reply to comment #4) > The problem Johan described is still reproducible with Xtext 2.2.1. I cannot reproduce what you describe. I would assume that the index in your workspace contains obsolete entries for grammars? Did you try a clean build? I've tried running a clean build but the problem persists, the grammar won't be found. So we still need the workaround (which I was attempting to remove) with a hand-made qualified name when querying the scope in getLinkedObjects. My test grammar: grammar org.some.Sample with org.eclipse.xtext.common.Terminals generate sample "sample" import "http://www.eclipse.org/2008/Xtext" Model: name=QualifiedName '{' imports+=Import* grammarRef+=GrammarRef* '}' ; GrammarRef: 'ref' name=ID ('in' ^grammar=[Grammar|QualifiedName])? ; Import: 'import' importedNamespace=QualifiedNameWithWildcard ; QualifiedNameWithWildcard: QualifiedName '.*'? ; QualifiedName: ID ('.' ID)*; ==== The test models: org.abc { import org.xyz.* ref Thing in Sample ref Thing2 in org.xyz.Sample } === grammar org.xyz.Sample generate model "model" Model: {Model} "STRING"; === Could you please provide more details about your concrete setup? Actually, qualified names _are_ now being correctly split into segments. So given the bug description, this bug has been fixed. So we have a local problem in our implementation that is merely related to this entry, my bad. Case closed. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |
Build Identifier: I20110613-1736 The default qualified names provider does not correctly split qualified names into segments (the wrong '::' delimiter is used) when linking objects. Reproducible: Always Steps to Reproduce: 1. Create Xtext grammar with rule 'grammar=[xtext::Grammar|QualifiedName]' 2. Try linking to exported Domainmodel grammar instance 3. Failure to link with message "The feature 'language' of 'com.x.y.z.CatalogImpl@5cdf858e{platform:/resource/com.x.y.z.tests/src/test/Sample.check#//@catalog}' contains an unresolved proxy 'org.eclipse.xtext.impl.GrammarImpl@4a378244{platform:/resource/com.x.y.z.tests/src/test/Sample.check#xtextLink_::0.1::4::/6}'" Workaround: overwrite *org.eclipse.xtext.xtext.XtextLinkingService.getLinkedObjects(EObject, EReference, INode)*