A completion proposal consists of a label to display in the completion popup, a list of text changes to apply when the proposal is selected, and additional information to describe the semantics of the proposal.
The label is combined of multiple parts to optinally separately stylize the displayed text. (getDisplayString(), getDisplayType(), getDisplayRelation()) The proposal label is usually displayed in the following format:
<getDisplayString()> : <getDisplayType()> - <getDisplayRelation()>If any of the extension display label methods return
null
, their part is omitted (with the preceeding
separator).
The text changes are a list of modifications to the source code which are applied after each other. All the positions in a text change is relative to the original document on which the proposal request was invoked. The text changes must not overlap in range. This is similar to the behaviour described in the Language Server Procol. See LSP TextEdit[] strucure.
Additional information may be displayed to the user when a proposal is highlighted. It can be returned in a formatted structure using getInformation().
public default String | Gets the relation label to display in the proposal popup for this item. |
public String | Gets the primary label to dislay in the proposal popup for this item. |
public default String | Gets the secondary label to display in the proposal popup for this item. |
public default PartitionedTextContent | Gets the semantic informations about this proposal. |
public default String | Gets the identifier that is associated with this proposal schema. |
public default Map< | Gets the schema meta-data that is associated with the proposal. |
public int | Gets the selection offset where the cursor should be moved to after the text changes are applied. |
public default String | Gets an arbitary text for sorting the proposals. |
public List< | Gets the edits to apply when this proposal is selected by the user. |
A good vlaue for this might be the enclosing related element in the source code for the semantic item in this proposal. (E.g. an enclosing class name for a called method, the task name for a proposed parameter name).
See the usual display format in the documentation of ScriptCompletionProposal.
See the usual display format in the documentation of ScriptCompletionProposal.
A good value for this might be the expected type of the semantic item for this proposal. (E.g. method/task return type.)
See the usual display format in the documentation of ScriptCompletionProposal.
null
if not available.The schema identifiers are arbitrary strings that should uniquely identify the nature of the proposal. It can be used by IDE plugins and others to interpret the proposal and present the user a more readable display.
One use case for this is to create IDE plugins that assign various icons for the proposal.
E.g.:
"org.company.scripting.proposal"
null
if none.The meta-data can contain arbitrary key-value pairs that can be used to describe various aspects of the proposal. This is used to convey information to the IDE plugins about different aspects of the proposal.
null
or empty.The returned offset is an offset in the resulting document. (Unlike the offsets in getTextChanges().)
Not all IDE implementations support this method.
IDE implementations may sort the proposals based on the returned text. The sorting is stable, equal elements will not be reordered.
Implementations should test the behaviour of returning non-null
from this method by testing in an
IDE.
Returning null
is usually fine.
null
.The regions in the text changes must not overlap.
The changes are applied in sequential order.