Page 1 of 1

Triggering auto completion plugin

Posted: Wed Mar 25, 2020 9:10 pm
by thomask
Hello to all,

I use the TEI-Completer plugin ( in Oxygen XML Editor 21.1. This plugin performs a http request to populate the content completion suggestions. It works without problems. As far as I can see it is invoked whenever the opening quotation marks of an attribute value are inserted in the editor. My question is: Does Oxygen trigger the content completion plugin only when the quotation marks are inserted or is it possible to configure / implement that on every keystroke the plugin is invoked and a request to the server made?
grafik.png (16.15 KiB) Viewed 2821 times
I confess, I do not understand the plugin code completely, so maybe my question is based on a wrong understanding, of how the process works.

Thank you for your help!
All the best,

Re: Triggering auto completion plugin

Posted: Wed Mar 25, 2020 9:26 pm
by thomask
I think I should clarify what I mean with "keystroke". When I enter for example "An" for the value of the attribute I want to make a request to the API which delivers all names starting with "An". The goal is to get a smaller result set which does consume less resources.

Thank you!

Re: Triggering auto completion plugin

Posted: Thu Mar 26, 2020 3:54 pm
by alex_jitianu
Hi Thomas,

I took a look at the plugin myself. It uses the SchemaManagerFilter API to contribute possible values for attributes. Oxygen will call this API whenever it requires the proposals for an attribute value, fir example when the user types the opening quote for an attribute value.

I assume the plugin takes awhile to retrieve all the values and as a result Oxygen freezes a bit, right? The plugin's implementation of this API is called TeiCompleter. The invoked method is filterAttributeValues() and it receives a {{WhatPossibleValuesHasAttributeContext}} object as a parameter. This object has a methods getCurrentValuePrefix() which would return any text already written by the user in the attribute's value. So if you type "An" inside the attribute value and then press Ctrl + Space when the caret is after "An", the previously mentioned method will return "An" and you can use it to retrieve just a subset from server.

At a glance, I don't see the plugin using this information for anything in getAutoCompleteSuggestions(), so it probably just gets all the values from the server.

You'll still have some cases in which all attributes will be retrieved, like for example when typing the starting quote of an attribute value.

Best regards,

Re: Triggering auto completion plugin

Posted: Mon Mar 30, 2020 10:43 am
by thomask
Hello Alex,

thank you very much for your reply.

I completely agree that it makes no sense to search for data which is a subset of information already retrieved.

Thank you again for the given information and the spent time.