Page 1 of 1

Find valid elements at caret position

Posted: Fri Sep 02, 2022 2:02 pm
by shilpa
Hi Team,

I would like to know how to get what and all elements can be renamed with the old element.
Example.
Say my cursor is at venue.name element and i want the list of elements which can be replaced with the venue.name element.
I have tried using authorSchemaManager.whatElementsCanGoHere(context); method to get the valid elements.
But i am getting same elements every time irrespective of cursor position.
image.png
Above image is the requirement which i need to implement veneue.name is the current element and below are the list of elements which i can replace with.
Here the list will change according to element but in my case the list is same for all the elements.

Re: Find all elements at caret position

Posted: Fri Sep 02, 2022 2:36 pm
by mihaela
Hi,

The elements returned by the specified API are the ones that are valid (can be inserted) at the specified position in document, according to the schema associated with your document.
If you invoke content completion in the same position, do you see other elements in the content completion list?

Best Regards,
Mihaela

Re: Find valid elements at caret position

Posted: Fri Sep 02, 2022 3:03 pm
by shilpa
Hi Mihaela,

Thanks for the reply.

do you see other elements in the content completion list?
Yes we are getting same set of list in all the caret position.

Thanks & Regards
Shilpa

Re: Find valid elements at caret position

Posted: Fri Sep 02, 2022 3:34 pm
by mihaela
Hi,

This means that your schema specifies that all these elements are valid in any position, so the API will always return the same list.
You will have to check the schema and update it to correctly set the valid elements.

Best Regards,
Mihaela

Re: Find valid elements at caret position

Posted: Mon Sep 05, 2022 9:47 am
by shilpa
Hi Mihaela,

Thanks for the update.

Could you please let us know how to update the schema to get the valid elements for custom plugin.

Best Regards,
Shilpa

Re: Find valid elements at caret position

Posted: Mon Sep 05, 2022 1:43 pm
by mihaela
Hello,

In order to help you we have to find more about your customization, like what type of schema are you using and what elements are you expecting to be valid in specific positions.
You can send us this information (and your current schema) on our support email address (support@oxygenxml.com).

Best Regards,
Mihaela