Implements a code snippet provider that can manage the available code snippets and handle requests for display of IntelliPrompt code snippet sessions.
- Inheritance:
- object object
- Implements:
-
ICode
Snippet IOrderable IKeyedProvider Object IEditorView ITextKey Input Event Sink View ITextLifecycle Event Sink View Tagger Provider
Remarks
Instances of this object can be registered with an ISyntax
Constructors
CodeSnippetProvider()
Initializes a new instance of the CodeSnippetProvider
class.
CodeSnippetProvider(string)
Initializes a new instance of the CodeSnippetProvider
class.
Parameter | Type | Description |
---|---|---|
key | string | The string-based key that identifies the provider. |
CodeSnippetProvider(string, params Ordering[])
Initializes a new instance of the CodeSnippetProvider
class.
Parameter | Type | Description |
---|---|---|
key | string | The string-based key that identifies the provider. |
orderings | Ordering[] | The array of Ordering objects, used to determine how this object is positioned relative to other objects. |
Properties
IsCaseSensitive
Gets or sets whether code snippet shortcut matching requires a case-sensitive match.
Property Value
- bool:
true
if code snippet shortcut matching requires a case-sensitive match; otherwise,false
. The default value istrue
.
Key
Gets the string-based key that identifies the provider.
Property Value
- string:
The string-based key that identifies the provider.
Orderings
Gets the collection of Ordering objects, used to determine how this object is positioned relative to other objects.
Property Value
- IEnumerable<Ordering>:
The collection of Ordering objects, used to determine how this object is positioned relative to other objects.
RootFolder
Gets or sets the root ICode
Property Value
- ICode
Snippet :Folder The root ICode
Snippet containing code snippets that are accessible by this provider.Folder
Methods
CheckForShortcut(IEditorView)
Checks for a code snippet shortcut before the caret and opens a template session if one was found.
Parameter | Type | Description |
---|---|---|
view | IEditor |
The IEditor |
Returns
- bool:
true
if a template session was opened; otherwise,false
.
CreateSelectionSession(ICodeSnippetFolder, CodeSnippetTypes)
Creates an ICode
Parameter | Type | Description |
---|---|---|
rootFolder | ICode |
The root ICode |
snippetType | Code |
A Code |
Returns
- ICode
Snippet :Selection Session The ICode
Snippet that was created.Selection Session
GetPossibleShortcutSnapshotRange(TextSnapshotOffset)
Returns a possible code snippet shortcut Text
Parameter | Type | Description |
---|---|---|
snapshotOffset | Text |
The Text |
Returns
- Text
Snapshot :Range The Text
Snapshot of the possible shortcut; orRange TextSnapshotRange.Deleted
if there is no possible shortcut.
Remarks
Language implementations may wish to inherit this class and override this method to ensure the shortcut is not within a comment or other literal.
OnViewKeyDown(IEditorView, KeyEventArgs)
Occurs when a key is pressed down while focus is in the specified IEditor
Parameter | Type | Description |
---|---|---|
view | IEditor |
The IEditor |
e | Key |
The |
OnViewKeyUp(IEditorView, KeyEventArgs)
Occurs when a key is released while focus is in the specified IEditor
Parameter | Type | Description |
---|---|---|
view | IEditor |
The IEditor |
e | Key |
The |
RequestSelectionSession(IEditorView, CodeSnippetTypes)
Requests that an ICode
Parameter | Type | Description |
---|---|---|
view | IEditor |
The IEditor |
snippetType | Code |
A Code |
Returns
- bool:
true
if a session was opened; otherwise,false
.
RequestTemplateSession(IEditorView, ICodeSnippet)
Requests that an ICode
Parameter | Type | Description |
---|---|---|
view | IEditor |
The IEditor |
codeSnippet | ICode |
The ICode |
Returns
- bool:
true
if a session was opened; otherwise,false
.