Partager via


ProvideLanguageEditorOptionPageAttribute Class

Provide a general method for setting a language service's editor tool option page.

Inheritance Hierarchy

Object
  Attribute
    Microsoft.VisualStudio.Shell.RegistrationAttribute
      Microsoft.VisualStudio.Shell.ProvideOptionDialogPageAttribute
        Microsoft.VisualStudio.Shell.ProvideLanguageEditorOptionPageAttribute

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.12.0 (in Microsoft.VisualStudio.Shell.12.0.dll)

Syntax

'Declaration
<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple := True, Inherited := True)> _
Public NotInheritable Class ProvideLanguageEditorOptionPageAttribute _
    Inherits ProvideOptionDialogPageAttribute
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class ProvideLanguageEditorOptionPageAttribute : ProvideOptionDialogPageAttribute
[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple = true, Inherited = true)]
public ref class ProvideLanguageEditorOptionPageAttribute sealed : public ProvideOptionDialogPageAttribute
[<Sealed>]
[<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true, Inherited = true)>]
type ProvideLanguageEditorOptionPageAttribute =  
    class 
        inherit ProvideOptionDialogPageAttribute 
    end
public final class ProvideLanguageEditorOptionPageAttribute extends ProvideOptionDialogPageAttribute

The ProvideLanguageEditorOptionPageAttribute type exposes the following members.

Constructors

  Name Description
Public method ProvideLanguageEditorOptionPageAttribute(Type, String, String, String, String) Initializes a new instance of ProvideLanguageEditorOptionPageAttribute for the specified page.
Public method ProvideLanguageEditorOptionPageAttribute(Type, String, String, String, String, Int32) Instantiates a new instance of ProvideLanguageEditorOptionPageAttribute.
Public method ProvideLanguageEditorOptionPageAttribute(Type, String, String, String, String, String) Instantiates a new instance of ProvideLanguageEditorOptionPageAttribute.
Public method ProvideLanguageEditorOptionPageAttribute(Type, String, String, String, String, array<String[]) Instantiates a new instance of ProvideLanguageEditorOptionPageAttribute.

Top

Properties

  Name Description
Public property Keywords Gets the keywords.
Public property LanguageName Gets the name of the language.
Public property PageGuid Gets the GUID of the option page.
Public property PageNameResourceId Gets the name resource ID of the page. (Inherited from ProvideOptionDialogPageAttribute.)
Public property PageType Gets the type of the page. (Inherited from ProvideOptionDialogPageAttribute.)
Public property TypeId Gets the current instance of this attribute. (Inherited from RegistrationAttribute.)

Top

Methods

  Name Description
Public method Equals Infrastructure. Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.)
Public method GetHashCode Returns the hash code for this instance. (Inherited from Attribute.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method IsDefaultAttribute When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute.)
Public method Match When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.)
Public method Register Creates all the registry keys and entries as specified by the class constructor. (Overrides RegistrationAttribute.Register(RegistrationAttribute.RegistrationContext).)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method Unregister Removes all of the registry keys and entries. (Overrides RegistrationAttribute.Unregister(RegistrationAttribute.RegistrationContext).)

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method System#Runtime#InteropServices#_Attribute#GetIDsOfNames Maps a set of names to a corresponding set of dispatch identifiers. (Inherited from Attribute.)
Explicit interface implemetationPrivate method System#Runtime#InteropServices#_Attribute#GetTypeInfo Retrieves the type information for an object, which can be used to get the type information for an interface. (Inherited from Attribute.)
Explicit interface implemetationPrivate method System#Runtime#InteropServices#_Attribute#GetTypeInfoCount Retrieves the number of type information interfaces that an object provides (either 0 or 1). (Inherited from Attribute.)
Explicit interface implemetationPrivate method System#Runtime#InteropServices#_Attribute#Invoke Provides access to properties and methods exposed by an object. (Inherited from Attribute.)

Top

Remarks

This information is stored in the registry key <RegistrationRoot>\Languages\Language Services\[language]\EditorToolsOptions, where [language] is the name of the language.

Under EditorToolsOptions is a tree of pages and sub-pages that can nest any number of levels. These pages correspond to the options pages displayed in the Visual Studio Tools Options for editors (where a tree of option pages is displayed under the language name, each page containing appropriate options).

Each key in this option page list contains a resource id or literal string containing the localized name of the page. This is what is actually shown in the Tools Options dialog. In addition, it also contains a package GUID and optionally a GUID of an option page.

If there is no option page GUID, then the key is considered to be a node in the tree of options and has no associated page. Otherwise, the key is a leaf in the tree, and its option page will be shown.

There can be multiple instances of this attribute, and each instance specifies a node or a property page. The attributes can appear in any order. If the property page GUID is specified then a property page is registered, otherwise it is a node that is registered.

The following user-defined attributes are used for language services:

Attribute

Description

ProvideLanguageServiceAttribute

Registers the language service with Visual Studio and specifies which features are supported.

ProvideLanguageExtensionAttribute

Associates a file extension with the language service.

ProvideLanguageEditorOptionPageAttribute

Specifies a property node or page for the Options dialog box specific to the language service.

ProvideLanguageCodeExpansionAttribute

Specifies location information to support code snippets in the language service.

ProvideServiceAttribute

Registers a language service as a Visual Studio service. All services supplied in managed code use this attribute.

Notes to Implementers

This attribute class cannot be inherited from so there is nothing to implement.

Notes to Callers

This attribute class is typically applied to your primary VSPackage class, although it can appear on any class. This attribute class can appear multiple times and in any order, once for each property page and node in the property page tree.

Examples

This example shows how this user-defined attribute is used to register two property pages ("General" and "Indent") and a property page node ("Formatting") that contains the "Indent" property page. Note how the second parameter to the constructor specifies the position in the registry relative to the node.

Note

Visual C# allows for a shorthand form of a user-defined attribute by dropping the "Attribute" part of the name. This shorthand form is used in this and all other examples throughout this class.

using Microsoft.VisualStudio.Shell;

namespace MyLanguagePackage
{
    internal class MyConstants
    {
        public const string languageName                = "MyLanguage";
        public const string formattingNodeResIDAsString = "#108";
        public const string generalPageResIDAsString    = "#109";
        public const string indentPageResIDAsString     = "#110";
    }

    [ProvideLanguageEditorOptionPage(MyConstants.languageName,
                                     "General",  // property page
                                     MyConstants.generalPageResIDAsString,
        // Optional language service properties
        OptionPageGuid = "{12434534-cecd-48e7-a866-45cad2e8b169}"
                                    )]
    [ProvideLanguageEditorOptionPage(MyConstants.languageName,
                                     "Formatting",  // property node
                                     MyConstants.formattingNodeResIDAsString
                                    )]
    [ProvideLanguageEditorOptionPage(MyConstants.languageName,
                                     @"Formatting\Indent",  // property page
                                     MyConstants.indentPageResIDAsString,
        // Optional language service properties
        OptionPageGuid = "{12434556-cecd-48e7-a866-45cad2e8b169}"
                                    )]

    class MyLanguagePackage
    {
    }
}

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.Shell Namespace