Freigeben über


Declarations Class

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

This API is not CLS-compliant. The CLS-compliant alternative is [None].

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Package.Declarations

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)

Syntax

'Declaration
<CLSCompliantAttribute(False)> _
Public MustInherit Class Declarations _
    Implements IDisposable
[CLSCompliantAttribute(false)]
public abstract class Declarations : IDisposable

The Declarations type exposes the following members.

Constructors

  Name Description
Protected method Declarations Initializes a new instance of the Declarations class.

Top

Properties

  Name Description
Public property LastBestMatch Gets or sets the name of the item that best matches what has been typed so far.

Top

Methods

  Name Description
Public method Dispose Frees any resources allocated by the class just before the class object is destroyed.
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetBestMatch Determines the best completion match for the specified value.
Public method GetCount When implemented in a derived class, gets the number of items in the list of declarations.
Public method GetDescription When implemented in a derived class, gets a description of the specified item.
Public method GetDisplayText When implemented in a derived class, gets the text to be displayed in the completion list for the specified item.
Public method GetGlyph When implemented in a derived class, gets the image to show next to the specified item.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetInitialExtent Returns the initial extent of the text to be completed.
Public method GetName When implemented in a derived class, gets the name or text to be inserted for the specified item.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method IsCommitChar Determines whether the specified character can be used to complete the specified text.
Public method IsMatch Determines whether the specified text matches some or all of the specified item.
Public method IsPerfectMatch
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method OnAutoComplete 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.
Public method OnCommit Called to commit the specified item to the source file.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

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

Returns description for specified item.

GetDisplayText

Returns text to be shown in the completion list for the specified item.

GetGlyph

Returns an index into an image list for the specified item.

GetName

Returns the text to be inserted for the specified item.

Notes to Callers

An instance of this class is returned from the GetDeclarations method in the AuthoringScope class. The GetDeclarations 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.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Package Namespace