ProvideLanguageEditorOptionPageAttribute 类

提供设置语言服务的编辑 " 工具选项 " 页提供泛型方法。

继承层次结构

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

命名空间:  Microsoft.VisualStudio.Shell
程序集:  Microsoft.VisualStudio.Shell.11.0(在 Microsoft.VisualStudio.Shell.11.0.dll 中)

语法

声明
<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

ProvideLanguageEditorOptionPageAttribute 类型公开以下成员。

构造函数

  名称 说明
公共方法 ProvideLanguageEditorOptionPageAttribute(Type, String, String, String, String) 初始化 ProvideLanguageEditorOptionPageAttribute 新的实例指定的页面。
公共方法 ProvideLanguageEditorOptionPageAttribute(Type, String, String, String, String, Int32)
公共方法 ProvideLanguageEditorOptionPageAttribute(Type, String, String, String, String, String)
公共方法 ProvideLanguageEditorOptionPageAttribute(Type, String, String, String, String, array<String[])

页首

属性

  名称 说明
公共属性 Keywords
公共属性 LanguageName 获取该语言的名称。
公共属性 PageGuid 获取选项卡页的 GUID。
公共属性 PageNameResourceId 获取页的名称资源 ID。 (继承自 ProvideOptionDialogPageAttribute。)
公共属性 PageType 获取页的类型。 (继承自 ProvideOptionDialogPageAttribute。)
公共属性 TypeId 获取此属性的当前实例。 (继承自 RegistrationAttribute。)

页首

方法

  名称 说明
公共方法 Equals 基础结构。返回一个值,该值指示此实例是否与指定的对象相等。 (继承自 Attribute。)
公共方法 GetHashCode 返回此实例的哈希代码。 (继承自 Attribute。)
公共方法 GetType 获取当前实例的 Type。 (继承自 Object。)
公共方法 IsDefaultAttribute 当在派生类中重写时,指示此实例的值是否是派生类的默认值。 (继承自 Attribute。)
公共方法 Match 当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。 (继承自 Attribute。)
公共方法 Register 创建任何注册表项和项按照指定由类构造函数。 (重写 RegistrationAttribute.Register(RegistrationAttribute.RegistrationContext)。)
公共方法 ToString 返回表示当前对象的字符串。 (继承自 Object。)
公共方法 Unregister 移除任何注册表项和项。 (重写 RegistrationAttribute.Unregister(RegistrationAttribute.RegistrationContext)。)

页首

显式接口实现

  名称 说明
显式接口实现私有方法 _Attribute.GetIDsOfNames 将一组名称映射为对应的一组调度标识符。 (继承自 Attribute。)
显式接口实现私有方法 _Attribute.GetTypeInfo 检索对象的类型信息,然后可以使用该信息获取接口的类型信息。 (继承自 Attribute。)
显式接口实现私有方法 _Attribute.GetTypeInfoCount 检索对象提供的类型信息接口的数量(0 或 1)。 (继承自 Attribute。)
显式接口实现私有方法 _Attribute.Invoke 提供对某一对象公开的属性和方法的访问。 (继承自 Attribute。)

页首

备注

此信息在注册表项 \Languages\Language Services\[language]\EditorToolsOptions RegistrationRoot中存储, [] 语言是该语言的名称。

在 EditorToolsOptions 下可以嵌套任意数量的级别页和子页的树。 这些页对应于编辑器 (其中的选项页树中显示的语言名称,它包含适当的选项) 的每页的 Visual Studio 工具选项的选项卡显示页。

在此选项卡页的每个键的列表包含页的本地化名称资源 ID 或文本字符串。 这就是 " 在 " 工具选项 " 对话框实际显示。 此外,它还包含一个包的 GUID 以及可选选项卡页的 GUID。

如果没有选项页 GUID,则键会将选项树中的节点并没有关联的页。 否则,键是在树的一块叶,因此,其选项页将显示。

可以具有此特性的多个实例,因此,每个实例指定节点或属性页。 属性可以按任意顺序显示。 如果属性页上的 GUID 则指定属性页进行注册,否则它是注册的节点。

以下用户定义的属性为语言服务使用:

特性

说明

ProvideLanguageServiceAttribute

注册 Visual Studio 的语言服务并指定哪些功能的支持。

ProvideLanguageExtensionAttribute

将文件扩展名与语言服务。

ProvideLanguageEditorOptionPageAttribute

为选项 " 对话框明确指定属性节点或页中语言服务。

ProvideLanguageCodeExpansionAttribute

在语言服务中指定位置信息支持代码段。

ProvideServiceAttribute

注册语言服务作为 Visual Studio 服务。 在托管代码中使用提供的所有服务此属性。

对实现者的说明

此特性类不能继承因此没有任何实现。

对调用者的说明

此特性类通常会应用于母版 VSPackage 类,不过,它可以出现在任何类。 此特性类可能出现多次并按任何顺序,一次的每个属性页和节点在属性页树。

示例

此示例演示此用户定义的属性如何在注册两个属性页 (“常规”和 “缩进”) 和包含 “缩进”属性页的属性页节点 (“格式设置”)。 请注意到构造函数的第二个参数指定如何在注册表的位置相对于节点。

备注

Visual C# 允许用户定义的属性的简短窗体中删除该名称的 “属性”部分。本快速输入窗体用于此和此类中的其他示例。

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

线程安全

此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。

请参见

参考

Microsoft.VisualStudio.Shell 命名空间