IntelliPromptSessionBase Class
Represents an abstract IntelliPrompt session.
public abstract class IntelliPromptSessionBase : IIntelliPromptSession, IServiceLocator
- Inheritance:
- object object
- Derived:
- CodeSnippetSelectionSession CodeSnippetTemplateSession CompletionSession ParameterInfoSession QuickInfoSession
- Implements:
- IIntelliPromptSession IServiceLocator
Constructors
IntelliPromptSessionBase()
Initializes an instance of the class.
protected IntelliPromptSessionBase()
Properties
Bounds
The view-relative bounds of the session's open popup, if available.
public abstract Rect? Bounds { get; }
Property Value
- Rect?
CanOpenForReadOnlyTextRanges
Indicates whether the session is able to be opened for read-only text ranges.
protected virtual bool CanOpenForReadOnlyTextRanges { get; }
Property Value
- bool:
trueif the session is able to be opened for read-only text ranges; otherwise,false. The default value istrue.
ClosesOnLostFocus
Indicates whether this session auto-closes when the editor or any IntelliPrompt popups lose focus.
public abstract bool ClosesOnLostFocus { get; }
Property Value
- bool:
trueif this session auto-closes when the editor or any IntelliPrompt popups lose focus; otherwise,false.
IsOpen
Indicates whether the session is currently open.
public bool IsOpen { get; }
Property Value
- bool:
trueif the session is currently open; otherwise,false.
SessionType
The IIntelliPromptSessionType that identifies the type of session.
public abstract IIntelliPromptSessionType SessionType { get; }
Property Value
SnapshotRange
The TextSnapshotRange containing the original TextRange in the ITextSnapshot that triggered the session.
public TextSnapshotRange? SnapshotRange { get; }
Property Value
Remarks
This member should only be used while the session is open.
SyncRoot
An object that can be used to synchronize access to the services.
View
The IEditorView in which the session is opened.
public IEditorView? View { get; }
Property Value
Remarks
This member should only be used while the session is open.
Methods
Close(bool)
Closes the session.
public void Close(bool cancelled)
| Parameter | Type | Description |
|---|---|---|
| cancelled | bool | Whether the session was closed due to a cancellation. |
GetAllServiceTypes()
Returns a collection of all the service types that have been registered.
GetPopupBounds(Popup)
Returns the view-relative bounds of the specified Popup.
protected Rect? GetPopupBounds(Popup popup)
| Parameter | Type | Description |
|---|---|---|
| popup | Popup | The popup to examine. |
Returns
- Rect?
GetService(object)
Returns the service that has been registered with the specified type.
public object? GetService(object serviceType)
| Parameter | Type | Description |
|---|---|---|
| serviceType | object | The type of service to return. |
Returns
GetService<T>()
Returns the service that has been registered with the specified type.
public T? GetService<T>()
- Type Parameters:
-
T-The type of service to return.
Returns
- T
OnClosed(CancelEventArgs)
Raises the Closed event.
protected virtual void OnClosed(CancelEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | CancelEventArgs | The event data. |
OnOpened(EventArgs)
Raises the Opened event.
protected virtual void OnOpened(EventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | EventArgs | The event data. |
OnServiceAdded(CollectionChangeEventArgs<object>)
Raises the ServiceAdded event.
protected virtual void OnServiceAdded(CollectionChangeEventArgs<object> e)
| Parameter | Type | Description |
|---|---|---|
| e | CollectionChangeEventArgs<object> | The event data. |
OnServiceRemoved(CollectionChangeEventArgs<object>)
Raises the ServiceRemoved event.
protected virtual void OnServiceRemoved(CollectionChangeEventArgs<object> e)
| Parameter | Type | Description |
|---|---|---|
| e | CollectionChangeEventArgs<object> | The event data. |
Open(IEditorView, TextRange?)
Opens the session, attaching to the specified IEditorView.
public void Open(IEditorView view, TextRange? textRange)
| Parameter | Type | Description |
|---|---|---|
| view | IEditorView | The IEditorView in which the session is opened. |
| textRange | TextRange? | The source TextRange in the view's current ITextSnapshot. |
RegisterService(object, object)
Registers a service instance for the specified service type.
public void RegisterService(object serviceType, object service)
| Parameter | Type | Description |
|---|---|---|
| serviceType | object | The type of service. |
| service | object | The service object instance. |
RegisterService<T>(T)
Registers a service instance for the specified service type.
public void RegisterService<T>(T service)
- Type Parameters:
-
T-The type of service.
| Parameter | Type | Description |
|---|---|---|
| service | T | The service object instance. |
Reposition()
Notifies the session that it should reposition its user interface.
public abstract void Reposition()
UnregisterService(object)
Unregisters a service of the specified service type.
public void UnregisterService(object serviceType)
| Parameter | Type | Description |
|---|---|---|
| serviceType | object | The type of service. |
UnregisterService<T>()
Unregisters a service of the specified service type.
public void UnregisterService<T>()
- Type Parameters:
-
T-The type of service.
Events
Closed
Occurs when the session is closed, with the Cancel flag on the event arguments indicating whether
the close was due to a cancellation.
Opened
Occurs when the session is opened.
ServiceAdded
Occurs after a service is added to the object.
public event EventHandler<CollectionChangeEventArgs<object>>? ServiceAdded
Event Type
ServiceRemoved
Occurs after a service is removed from the object.
public event EventHandler<CollectionChangeEventArgs<object>>? ServiceRemoved
Event Type
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()