Community
Participate
Working Groups
If you create an error/warning for an object X (error source) not located in the current resource (of the context object O), the marker is created for the resource of O rather than that of X. The node model information of X is used. Example Grammar: Model: greetings+=Greeting* ('ref' ref=[Greeting])?; Greeting: 'Hello' name=ID '!'; Example Validation: @Check public void checkGreetingStartsWithCapital(Model model) { if(model.getRef()!=null){ if (!Character.isUpperCase(model.getRef().getName().charAt(0))) { error("Name must start with a capital", model.getRef(),MyDslPackage.Literals.GREETING__NAME,0); } } } Sample file1: Hello sven! Hello Sebastian! Sample file2: /*comment*/ ref sven In this (stupid) example, the reference (file2) checks whether some property of the referenced object is satisfied and tries to mark the error in the target (file1). However, the marker/annotation is created in file2. It seems that the URI of the error source object is not taken into account. This issue exists for Xtext 1.x as well.
I think we should throw a runtime exception (IllegalArgument) if one tries to create issues for the wrong resource.
pushed to master
Requested via bug 522520. -M.