CodeSnippetTemplateSession Class
Represents an IntelliPrompt code snippet template session.
public class CodeSnippetTemplateSession : IntelliPromptSessionBase, ICodeSnippetTemplateSession, IIntelliPromptSession, IServiceLocator, IEditorDocumentTextChangeEventSink, IEditorViewKeyInputEventSink, IEditorViewSelectionChangeEventSink
- Inheritance:
- object IntelliPromptSessionBase object
- Implements:
- ICodeSnippetTemplateSession IIntelliPromptSession IServiceLocator IEditorDocumentTextChangeEventSink IEditorViewKeyInputEventSink IEditorViewSelectionChangeEventSink
Constructors
CodeSnippetTemplateSession(ICodeSnippet)
Initializes an instance of the class.
public CodeSnippetTemplateSession(ICodeSnippet codeSnippet)
| Parameter | Type | Description |
|---|---|---|
| codeSnippet | ICodeSnippet |
Properties
ActiveDeclaration
The ICodeSnippetDeclaration that is currently active, if any.
Bounds
The view-relative bounds of the session's open popup, if available.
public override Rect? Bounds { get; }
Property Value
- Rect?
CanOpenForReadOnlyTextRanges
Indicates whether the session is able to be opened for read-only text ranges.
protected override 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 override bool ClosesOnLostFocus { get; }
Property Value
- bool:
trueif this session auto-closes when the editor or any IntelliPrompt popups lose focus; otherwise,false.
CodeSnippet
The code snippet to activate.
IsAutoIndentEnabled
Indicates whether to auto-indent code snippet code based on the tab stop level of the current line.
public bool IsAutoIndentEnabled { get; set; }
Property Value
- bool:
trueif the code snippet code should be auto-indented; otherwise,false.
SessionType
The IIntelliPromptSessionType that identifies the type of session.
public override IIntelliPromptSessionType SessionType { get; }
Property Value
Methods
NotifyPropertyChanged(string)
Notifies that a property's value has changed.
[Obsolete("Use one of the new SetProperty or OnPropertyChanged methods instead of this deprecated NotifyPropertyChanged method.", false)]
protected void NotifyPropertyChanged(string name)
| Parameter | Type | Description |
|---|---|---|
| name | string | The name of the property. |
OnClosed(CancelEventArgs)
Raises the Closed event.
protected override void OnClosed(CancelEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | CancelEventArgs | The event data. |
OnDocumentTextChanged(SyntaxEditor, EditorSnapshotChangedEventArgs)
Occurs after a text change occurs to an IEditorDocument that uses this language.
protected virtual void OnDocumentTextChanged(SyntaxEditor editor, EditorSnapshotChangedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| editor | SyntaxEditor | The SyntaxEditor whose IEditorDocument is changed. |
| e | EditorSnapshotChangedEventArgs | The event data. |
OnDocumentTextChanging(SyntaxEditor, EditorSnapshotChangingEventArgs)
Occurs before a text change occurs to an IEditorDocument that uses this language.
protected virtual void OnDocumentTextChanging(SyntaxEditor editor, EditorSnapshotChangingEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| editor | SyntaxEditor | The SyntaxEditor whose IEditorDocument is changed. |
| e | EditorSnapshotChangingEventArgs | The event data. |
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. |
OnViewKeyDown(IEditorView, KeyEventArgs)
Occurs when a key is pressed down while focus is in the specified IEditorView.
protected virtual void OnViewKeyDown(IEditorView view, KeyEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| view | IEditorView | The IEditorView that received the event. |
| e | KeyEventArgs | The |
OnViewKeyUp(IEditorView, KeyEventArgs)
Occurs when a key is released while focus is in the specified IEditorView.
protected virtual void OnViewKeyUp(IEditorView view, KeyEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| view | IEditorView | The IEditorView that received the event. |
| e | KeyEventArgs | The |
OnViewSelectionChanged(IEditorView, EditorViewSelectionEventArgs)
Occurs when the selection is changed in the specified IEditorView.
protected virtual void OnViewSelectionChanged(IEditorView view, EditorViewSelectionEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| view | IEditorView | The IEditorView that received the event. |
| e | EditorViewSelectionEventArgs | The |
Open(IEditorView)
The ICodeSnippetDeclaration that is currently active, if any.
public void Open(IEditorView view)
| Parameter | Type | Description |
|---|---|---|
| view | IEditorView |
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:
trueif the property was changed; otherwise,false.
Events
PropertyChanged
Occurs when a property value changes.
Inherited Members
- IntelliPromptSessionBase.GetAllServiceTypes()
- IntelliPromptSessionBase.GetService<T>()
- IntelliPromptSessionBase.GetService(object)
- IntelliPromptSessionBase.RegisterService<T>(T)
- IntelliPromptSessionBase.RegisterService(object, object)
- IntelliPromptSessionBase.UnregisterService<T>()
- IntelliPromptSessionBase.UnregisterService(object)
- IntelliPromptSessionBase.Close(bool)
- IntelliPromptSessionBase.OnServiceAdded(CollectionChangeEventArgs<object>)
- IntelliPromptSessionBase.OnServiceRemoved(CollectionChangeEventArgs<object>)
- IntelliPromptSessionBase.Open(IEditorView, TextRange?)
- IntelliPromptSessionBase.GetPopupBounds(Popup)
- IntelliPromptSessionBase.IsOpen
- IntelliPromptSessionBase.SnapshotRange
- IntelliPromptSessionBase.SyncRoot
- IntelliPromptSessionBase.View
- IntelliPromptSessionBase.Closed
- IntelliPromptSessionBase.Opened
- IntelliPromptSessionBase.ServiceAdded
- IntelliPromptSessionBase.ServiceRemoved
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()