Share via


ProvideLanguageEditorOptionPageAttribute Class

Definition

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

public ref class ProvideLanguageEditorOptionPageAttribute sealed : Microsoft::VisualStudio::Shell::ProvideOptionDialogPageAttribute
public ref class ProvideLanguageEditorOptionPageAttribute sealed : Microsoft::VisualStudio::Shell::ProvideOptionDialogPageAttribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)]
public sealed class ProvideLanguageEditorOptionPageAttribute : Microsoft.VisualStudio.Shell.ProvideOptionDialogPageAttribute
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)>]
type ProvideLanguageEditorOptionPageAttribute = class
    inherit ProvideOptionDialogPageAttribute
Public NotInheritable Class ProvideLanguageEditorOptionPageAttribute
Inherits ProvideOptionDialogPageAttribute
Inheritance
ProvideLanguageEditorOptionPageAttribute
Attributes

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

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 Inheritors

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.

Constructors

ProvideLanguageEditorOptionPageAttribute(Type, String, String, String, String, Int32)

Instantiates a new instance of ProvideLanguageEditorOptionPageAttribute.

ProvideLanguageEditorOptionPageAttribute(Type, String, String, String, String, String)

Instantiates a new instance of ProvideLanguageEditorOptionPageAttribute.

ProvideLanguageEditorOptionPageAttribute(Type, String, String, String, String, String[])

Instantiates a new instance of ProvideLanguageEditorOptionPageAttribute.

Properties

IsInUnifiedSettings

Gets or sets a value indicating whether the settings in this page have been onboarded to Unified Settings through the creation of new registration. If true, the page is hidden when Unified Settings is enabled so its settings aren't duplicated.

Keywords

Gets the keywords.

LanguageName

Gets the name of the language.

PageGuid

Gets the GUID of the option page.

PageNameResourceId

Gets the name resource ID of the page.

(Inherited from ProvideOptionDialogPageAttribute)
PageType

Gets the type of the page.

(Inherited from ProvideOptionDialogPageAttribute)
TypeId

Override the TypeID property in order to let the RegistrationAttribute derived classes to work with System.ComponentModel.TypeDescriptor.GetAttributes(...). An attribute derived from this one will have to override this property only if it needs a better control on the instances that can be applied to a class.

(Inherited from RegistrationAttribute)

Methods

GetPackageRegKeyPath(Guid)

Gets the registry path (relative to the registry root of the application) of the VSPackage.

(Inherited from RegistrationAttribute)
Register(RegistrationAttribute+RegistrationContext)

Creates all the registry keys and entries as specified by the class constructor.

Unregister(RegistrationAttribute+RegistrationContext)

Removes all of the registry keys and entries.

Applies to