Export (0) Print
Expand All

ProvideLanguageEditorOptionPageAttribute Class

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

System.Object
  System.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)

[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class ProvideLanguageEditorOptionPageAttribute : ProvideOptionDialogPageAttribute

The ProvideLanguageEditorOptionPageAttribute type exposes the following members.

  NameDescription
Public methodProvideLanguageEditorOptionPageAttribute(Type, String, String, String, String)Initializes a new instance of ProvideLanguageEditorOptionPageAttribute for the specified page.
Public methodProvideLanguageEditorOptionPageAttribute(Type, String, String, String, String, Int32)Instantiates a new instance of ProvideLanguageEditorOptionPageAttribute.
Public methodProvideLanguageEditorOptionPageAttribute(Type, String, String, String, String, String)Instantiates a new instance of ProvideLanguageEditorOptionPageAttribute.
Public methodProvideLanguageEditorOptionPageAttribute(Type, String, String, String, String, String[])Instantiates a new instance of ProvideLanguageEditorOptionPageAttribute.
Top

  NameDescription
Public propertyKeywordsGets the keywords.
Public propertyLanguageNameGets the name of the language.
Public propertyPageGuidGets the GUID of the option page.
Public propertyPageNameResourceIdGets the name resource ID of the page. (Inherited from ProvideOptionDialogPageAttribute.)
Public propertyPageTypeGets the type of the page. (Inherited from ProvideOptionDialogPageAttribute.)
Public propertyTypeIdGets the current instance of this attribute. (Inherited from RegistrationAttribute.)
Top

  NameDescription
Public methodEqualsInfrastructure. Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.)
Public methodGetHashCodeReturns the hash code for this instance. (Inherited from Attribute.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIsDefaultAttributeWhen overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute.)
Public methodMatchWhen overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.)
Public methodRegisterCreates all the registry keys and entries as specified by the class constructor. (Overrides RegistrationAttribute.Register(RegistrationAttribute.RegistrationContext).)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodUnregisterRemoves all of the registry keys and entries. (Overrides RegistrationAttribute.Unregister(RegistrationAttribute.RegistrationContext).)
Top

  NameDescription
Explicit interface implemetationPrivate method_Attribute.GetIDsOfNamesMaps a set of names to a corresponding set of dispatch identifiers. (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute.GetTypeInfoRetrieves 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_Attribute.GetTypeInfoCountRetrieves the number of type information interfaces that an object provides (either 0 or 1). (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute.InvokeProvides access to properties and methods exposed by an object. (Inherited from Attribute.)
Top

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.

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.

NoteNote

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
    {
    }
}

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