Interface ICompletionProposal

  • All Known Implementing Classes:
    CompletionProposal, TemplateProposal

    public interface ICompletionProposal
    The interface of completion proposals generated by content assist processors. A completion proposal contains information used to present the proposed completion to the user, to insert the completion should the user select it, and to present context information for the chosen completion once it has been inserted.

    In order to provide backward compatibility for clients of ICompletionProposal, extension interfaces are used to provide a means of evolution. The following extension interfaces exist:

    • ICompletionProposalExtension since version 2.0 introducing the following functions:
      • handling of trigger characters other than ENTER
      • completion proposal validation for a given offset
      • context information can be freely positioned
    • ICompletionProposalExtension2 since version 2.1 introducing the following functions:
      • handling of trigger characters with modifiers
      • visual indication for selection of a proposal
    • ICompletionProposalExtension3 since version 3.0 introducing the following functions:
      • provision of a custom information control creator
      • provide a custom completion text and offset for prefix completion
    • ICompletionProposalExtension4 since version 3.1 introducing the following functions:
      • specify whether a proposal is automatically insertable
    • ICompletionProposalExtension5 since version 3.2 introducing the following function:
      • Allow background computation of the additional info
    • ICompletionProposalExtension6 since version 3.4 introducing the following function:
      • Allow styled ranges in the display string.
    • ICompletionProposalExtension7 since version 3.11 introducing the following function:
      • Emphasize ranges in the styled display string of the proposal that match the token at the current caret offset.

    This interface can be implemented by clients. By default, clients use CompletionProposal as the standard implementer of this interface.

    See Also:
    IContentAssistProcessor
    • Method Detail

      • apply

        void apply​(IDocument document)
        Inserts the proposed completion into the given document.
        Parameters:
        document - the document into which to insert the proposed completion
      • getSelection

        Point getSelection​(IDocument document)
        Returns the new selection after the proposal has been applied to the given document in absolute document coordinates. If it returns null, no new selection is set. A document change can trigger other document changes, which have to be taken into account when calculating the new selection. Typically, this would be done by installing a document listener or by using a document position during apply(IDocument).
        Parameters:
        document - the document into which the proposed completion has been inserted
        Returns:
        the new selection in absolute document coordinates
      • getAdditionalProposalInfo

        String getAdditionalProposalInfo()
        Returns optional additional information about the proposal. The additional information will be presented to assist the user in deciding if the selected proposal is the desired choice.

        If ICompletionProposalExtension5 is implemented, this method should not be called any longer. This method may be deprecated in a future release.

        Returns:
        the additional information or null
      • getImage

        Image getImage()
        Returns the image to be displayed in the list of completion proposals. The image would typically be shown to the left of the display string.
        Returns:
        the image to be shown or null if no image is desired
      • getContextInformation

        IContextInformation getContextInformation()
        Returns optional context information associated with this proposal. The context information will automatically be shown if the proposal has been applied.
        Returns:
        the context information for this proposal or null