0
votes

Xtend comes with really convenient ways to deal with quickfixes, but when I do

acceptor.accept(issue, "Change to " + correction, 'Replace the parameter.', 'error.png') [ element, context |

        ...
        ]

the element is not the EObject targeted by the issue, but its container. How can I have access to this specific element?

Thank you by advance.

1
how do you create the issue? does the container have multiple of the type you search or is there only one? - Christian Dietrich
no i mean: where do you create the issues. if you want to have the child as element you need to create the issue on the child - Christian Dietrich
This piece of code is supposed to be generic, the container could be of different types, as I test the validity of a parameter, and will have several children of the type I am looking for. I raise a static string in error in validator for the Fix @Fix(AnBxValidator.INVALID_PARAMETER) def replacePrameter(Issue issue, IssueResolutionAcceptor acceptor) { ... }` This code proposes to change the variable to well-type declared one, but I want in addition to change the declaration type if possible. I need to access to the declaration of the variable, but from its parent, it is not possible. - Remi Garcia
i still dont understand. can you please update your question and give a complete sample incl grammar, validator and quickfix - Christian Dietrich
I just figured it out. I put the child's literal in the error, but the validator started from the parent to check everything, sorry for this silly error. Resolved - Remi Garcia

1 Answers

0
votes

Please make sure that the EObject you report the error for and the one you expect inside the QuickFix are the same

    warning('Name should start with a capital', 
        greeting,
        MyDslPackage.Literals.GREETING__NAME,
        INVALID_NAME)