In This Article

CodeSnippetSelectionSession Class

Represents an IntelliPrompt code snippet selection session.

public class CodeSnippetSelectionSession : IntelliPromptSessionBase, ICodeSnippetSelectionSession, IIntelliPromptSession, IServiceLocator, IEditorViewPointerInputEventSink
Inheritance:
object IntelliPromptSessionBase object
Implements:
ICodeSnippetSelectionSession IIntelliPromptSession IServiceLocator IEditorViewPointerInputEventSink

Constructors

CodeSnippetSelectionSession(ICodeSnippetFolder)

Initializes an instance of the class.

public CodeSnippetSelectionSession(ICodeSnippetFolder rootFolder)
Parameter Type Description
rootFolder ICodeSnippetFolder

Properties

Bounds

The view-relative bounds of the session's open popup, if available.

public override Rectangle? Bounds { get; }

Property Value

Rectangle?

CanOpenForReadOnlyTextRanges

Indicates whether the session is able to be opened for read-only text ranges.

protected override bool CanOpenForReadOnlyTextRanges { get; }

Property Value

bool:

true if the session is able to be opened for read-only text ranges; otherwise, false. The default value is true.

ClosesOnLostFocus

Indicates whether this session auto-closes when the editor or any IntelliPrompt popups lose focus.

public override bool ClosesOnLostFocus { get; }

Property Value

bool:

true if this session auto-closes when the editor or any IntelliPrompt popups lose focus; otherwise, false.

Label

The label text to display on the popup.

public string? Label { get; set; }

Property Value

string

RootFolder

The root ICodeSnippetFolder containing the code snippets to display.

public ICodeSnippetFolder RootFolder { get; }

Property Value

ICodeSnippetFolder

SessionType

The IIntelliPromptSessionType that identifies the type of session.

public override IIntelliPromptSessionType SessionType { get; }

Property Value

IIntelliPromptSessionType

Methods

CreateDescriptionProvider(ICodeSnippetMetadata)

Creates an IContentProvider that provides a completion list description tip for the specified ICodeSnippetMetadata.

protected virtual IContentProvider? CreateDescriptionProvider(ICodeSnippetMetadata metadata)
Parameter Type Description
metadata ICodeSnippetMetadata

The ICodeSnippetMetadata to examine.

Returns

IContentProvider

CreatePopupContent()

Creates an IntelliPromptCodeSnippetSelector that is to be displayed in a popup.

protected virtual IntelliPromptCodeSnippetSelector CreatePopupContent()

Returns

IntelliPromptCodeSnippetSelector

OnClosed(CancelEventArgs)

Raises the Closed event.

protected override void OnClosed(CancelEventArgs e)
Parameter Type Description
e CancelEventArgs

The event data.

OnCompletionSessionInitializing(ICompletionSession)

Called when the ICompletionSession used for this code snippet selection session in about to be initialized.

protected virtual void OnCompletionSessionInitializing(ICompletionSession session)
Parameter Type Description
session ICompletionSession

The ICompletionSession to initialize.

Remarks

Override this method to set custom settings on the ICompletionSession before it is opened. The default implementation of this method sorts the items in the session.

OnOpened(EventArgs)

Raises the Opened event.

protected override void OnOpened(EventArgs e)
Parameter Type Description
e EventArgs

The event data.

OnPropertyChanged(PropertyChangedEventArgs)

Raises the PropertyChanged event.

protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
Parameter Type Description
e PropertyChangedEventArgs

The event data.

OnPropertyChanged(string?)

Raises the PropertyChanged event.

protected void OnPropertyChanged(string? propertyName = null)
Parameter Type Description
propertyName string

(Optional) The name of the property that changed.

OnViewPointerPressed(IEditorView, InputPointerButtonEventArgs)

Occurs when a pointer button is pressed over the specified IEditorView.

protected virtual void OnViewPointerPressed(IEditorView view, InputPointerButtonEventArgs e)
Parameter Type Description
view IEditorView

The IEditorView that received the event.

e InputPointerButtonEventArgs

The InputPointerButtonEventArgs that contains the event data.

Open(IEditorView)

Opens the session, attaching to the specified IEditorView.

public void Open(IEditorView view)
Parameter Type Description
view IEditorView

The IEditorView in which the session is opened.

Reposition()

Notifies the session that it should reposition its user interface.

public override void Reposition()

SetProperty<T>(ref T, T, string?)

Called from a property setter to change the backing field's value and raise PropertyChanged notification events if the new value is not equal to the current value.

protected bool SetProperty<T>(ref T field, T newValue, string? propertyName = null)
Type Parameters:
T -

The type of the property that changed.

Parameter Type Description
field T

The backing field that holds the property's value, which may be updated.

newValue T

The new property value.

propertyName string

(Optional) The name of the property that changed.

Returns

bool:

true if the property was changed; otherwise, false.

Events

PropertyChanged

Occurs when a property value changes.

public event PropertyChangedEventHandler? PropertyChanged

Event Type

PropertyChangedEventHandler

Inherited Members

Extension Methods