Trait sourceview5::CompletionProviderExt[][src]

pub trait CompletionProviderExt: 'static {
    fn activate<P: IsA<CompletionProposal>>(
        &self,
        context: &CompletionContext,
        proposal: &P
    );
fn display<P: IsA<CompletionProposal>>(
        &self,
        context: &CompletionContext,
        proposal: &P,
        cell: &CompletionCell
    );
fn get_priority(&self, context: &CompletionContext) -> i32;
fn get_title(&self) -> Option<GString>;
fn is_trigger(&self, iter: &TextIter, ch: char) -> bool;
fn key_activates<P: IsA<CompletionProposal>>(
        &self,
        context: &CompletionContext,
        proposal: &P,
        keyval: u32,
        state: ModifierType
    ) -> bool;
fn list_alternates<P: IsA<CompletionProposal>>(
        &self,
        context: &CompletionContext,
        proposal: &P
    ) -> Vec<CompletionProposal>;
fn populate_async<P: IsA<Cancellable>, Q: FnOnce(Result<ListModel, Error>) + Send + 'static>(
        &self,
        context: &CompletionContext,
        cancellable: Option<&P>,
        callback: Q
    );
fn populate_async_future(
        &self,
        context: &CompletionContext
    ) -> Pin<Box_<dyn Future<Output = Result<ListModel, Error>> + 'static>>;
fn refilter<P: IsA<ListModel>>(
        &self,
        context: &CompletionContext,
        model: &P
    ); }

Trait containing all CompletionProvider methods.

Feature: v5_0

Implementors

CompletionProvider, CompletionSnippets, CompletionWords

Required methods

fn activate<P: IsA<CompletionProposal>>(
    &self,
    context: &CompletionContext,
    proposal: &P
)
[src]

This function requests proposal to be activated by the CompletionProvider.

What the provider does to activate the proposal is specific to that provider. Many providers may choose to insert a Snippet with edit points the user may cycle through.

See also: Snippet, SnippetChunk, View::push_snippet

Feature: v5_0

context

a CompletionContext

proposal

a CompletionProposal

fn display<P: IsA<CompletionProposal>>(
    &self,
    context: &CompletionContext,
    proposal: &P,
    cell: &CompletionCell
)
[src]

This function requests that the CompletionProvider prepares cell to display the contents of proposal. Based on cells column type, you may want to display different information.

This allows for columns of information among completion proposals resulting in better alignment of similar content (icons, return types, method names, and parameter lists).

Feature: v5_0

context

a CompletionContext

proposal

a CompletionProposal

cell

a CompletionCell

fn get_priority(&self, context: &CompletionContext) -> i32[src]

This function should return the priority of self in context.

The priority is used to sort groups of completion proposals by provider so that higher priority providers results are shown above lower priority providers.

Lower value indicates higher priority.

Feature: v5_0

context

a CompletionContext

fn get_title(&self) -> Option<GString>[src]

Gets the title of the completion provider, if any.

Currently, titles are not displayed in the completion results, but may be at some point in the future when non-None.

Feature: v5_0

Returns

a title for the provider or None

fn is_trigger(&self, iter: &TextIter, ch: char) -> bool[src]

This function is used to determine of a character inserted into the text editor should cause a new completion request to be triggered.

An example would be period ‘.’ which might indicate that the user wants to complete method or field names of an object.

Feature: v5_0

iter

a gtk::TextIter

ch

a gunichar of the character inserted

fn key_activates<P: IsA<CompletionProposal>>(
    &self,
    context: &CompletionContext,
    proposal: &P,
    keyval: u32,
    state: ModifierType
) -> bool
[src]

This function is used to determine if a key typed by the user should activate proposal (resulting in committing the text to the editor).

This is useful when using languages where convention may lead to less typing by the user. One example may be the use of “.” or “-” to expand a field access in the C programming language.

Feature: v5_0

context

a CompletionContext

proposal

a CompletionProposal

keyval

a keyval such as GDK_KEY_period

state

a gdk::ModifierType or 0

fn list_alternates<P: IsA<CompletionProposal>>(
    &self,
    context: &CompletionContext,
    proposal: &P
) -> Vec<CompletionProposal>
[src]

Providers should return a list of alternates to proposal or None if there are no alternates available. This can be used by the completion view to allow the user to move laterally through similar proposals, such as overrides of methods by the same name.

Feature: v5_0

context

a CompletionContext

proposal

a CompletionProposal

Returns

a glib::PtrArray of CompletionProposal or None.

fn populate_async<P: IsA<Cancellable>, Q: FnOnce(Result<ListModel, Error>) + Send + 'static>(
    &self,
    context: &CompletionContext,
    cancellable: Option<&P>,
    callback: Q
)
[src]

Asynchronously requests that the provider populates the completion results for context.

For providers that would like to populate a gio::ListModel while those results are displayed to the user, CompletionContext::set_proposals_for_provider may be used to reduce latency until the user sees results.

Feature: v5_0

context

a CompletionContext

cancellable

a gio::Cancellable or None

callback

a callback to execute upon completion

user_data

closure data for callback

fn populate_async_future(
    &self,
    context: &CompletionContext
) -> Pin<Box_<dyn Future<Output = Result<ListModel, Error>> + 'static>>
[src]

fn refilter<P: IsA<ListModel>>(&self, context: &CompletionContext, model: &P)[src]

This function can be used to filter results previously provided to the CompletionContext by the CompletionProvider.

This can happen as the user types additionl text onto the word so that previously matched items may be removed from the list instead of generating new gio::ListModel of results.

Feature: v5_0

context

a CompletionContext

model

a gio::ListModel

Loading content...

Implementors

impl<O: IsA<CompletionProvider>> CompletionProviderExt for O[src]

Loading content...