Declarations Class

Definition

Important

This API is not CLS-compliant.

Manages a list of declarations to be shown in an IntelliSense drop-down list.

public ref class Declarations abstract : IDisposable
[System.CLSCompliant(false)]
public abstract class Declarations : IDisposable
public abstract class Declarations : IDisposable
[<System.CLSCompliant(false)>]
type Declarations = class
    interface IDisposable
type Declarations = class
    interface IDisposable
Public MustInherit Class Declarations
Implements IDisposable
Inheritance
Declarations
Attributes
Implements

Remarks

This abstract class is used to manage a list of identifiers or declarations that are shown in an IntelliSense member completion list. If you intend to support IntelliSense in your application, you must provide a concrete class that derives from this class.

Notes to Implementers

The implemented methods of this class assume that the declarations are stored in a list that is sorted in ascending order.

If you intend to support the IntelliSense completion list, you must derive a class from the Declarations class and implement the following abstract methods:

Abstract Method Description
GetCount() Returns number of items in declarations list
GetDescription(Int32) Returns description for specified item.
GetDisplayText(Int32) Returns text to be shown in the completion list for the specified item.
GetGlyph(Int32) Returns an index into an image list for the specified item.
GetName(Int32) Returns the text to be inserted for the specified item.

Notes to Callers

An instance of this class is returned from the GetDeclarations(IVsTextView, Int32, Int32, TokenInfo, ParseReason) method in the AuthoringScope class. The GetDeclarations(IVsTextView, Int32, Int32, TokenInfo, ParseReason) method must be implemented in a class derived from the AuthoringScope class. How your version of the Declarations class is populated is entirely up to you. The Declarations class is populated by the parser.

Constructors

Declarations()

Initializes a new instance of the Declarations class.

Properties

LastBestMatch

Gets or sets the name of the item that best matches what has been typed so far.

Methods

Dispose()

Frees any resources allocated by the class just before the class object is destroyed.

GetBestMatch(String, Int32, Boolean)

Determines the best completion match for the specified value.

GetCount()

When implemented in a derived class, gets the number of items in the list of declarations.

GetDescription(Int32)

When implemented in a derived class, gets a description of the specified item.

GetDisplayText(Int32)

When implemented in a derived class, gets the text to be displayed in the completion list for the specified item.

GetGlyph(Int32)

When implemented in a derived class, gets the image to show next to the specified item.

GetInitialExtent(IVsTextView, Int32, Int32, Int32)

Override this method if you want to customize how the initial extent is calculated. If you do not implement this method the the Source object GetWordExtent will be used by default.

GetName(Int32)

When implemented in a derived class, gets the name or text to be inserted for the specified item.

IsCommitChar(String, Int32, Char)

Determines whether the specified character can be used to complete the specified text.

IsMatch(String, Int32)

Determines whether the specified text matches some or all of the specified item.

IsPerfectMatch(String, Int32)

Determines whether the specified text matches all of the specified item.

OnAutoComplete(IVsTextView, String, Char, Int32)

Called after the declaration has been committed to the source file. When implemented in a derived class, it provides a completion character which may itself be a trigger for another round of IntelliSense.

OnCommit(IVsTextView, String, Char, Int32, TextSpan)

Called to commit the specified item to the source file.

Applies to