Find valid elements at caret position

Having trouble installing Oxygen? Got a bug to report? Post it all here.
shilpa
Posts: 68
Joined: Mon Jul 04, 2022 8:42 am

Find valid elements at caret position

Post 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.
You do not have the required permissions to view the files attached to this post.
Last edited by shilpa on Fri Sep 02, 2022 2:54 pm, edited 1 time in total.
mihaela
Posts: 515
Joined: Wed May 20, 2009 2:40 pm

Re: Find all elements at caret position

Post 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
Mihaela Calotescu
http://www.oxygenxml.com
shilpa
Posts: 68
Joined: Mon Jul 04, 2022 8:42 am

Re: Find valid elements at caret position

Post 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
mihaela
Posts: 515
Joined: Wed May 20, 2009 2:40 pm

Re: Find valid elements at caret position

Post 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
Mihaela Calotescu
http://www.oxygenxml.com
shilpa
Posts: 68
Joined: Mon Jul 04, 2022 8:42 am

Re: Find valid elements at caret position

Post 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
mihaela
Posts: 515
Joined: Wed May 20, 2009 2:40 pm

Re: Find valid elements at caret position

Post 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
Mihaela Calotescu
http://www.oxygenxml.com
Post Reply