IVsLanguageInfo 接口

检索有关一种编程语言或标记语言的信息,包括语言名称、关联的文件扩展名和 colorizer 要求的代码编辑器。

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

语法

声明
<InterfaceTypeAttribute()> _
<GuidAttribute("11DDB920-52C7-4237-8610-9FE8BB11656D")> _
Public Interface IVsLanguageInfo
[InterfaceTypeAttribute()]
[GuidAttribute("11DDB920-52C7-4237-8610-9FE8BB11656D")]
public interface IVsLanguageInfo
[InterfaceTypeAttribute()]
[GuidAttribute(L"11DDB920-52C7-4237-8610-9FE8BB11656D")]
public interface class IVsLanguageInfo
[<InterfaceTypeAttribute()>]
[<GuidAttribute("11DDB920-52C7-4237-8610-9FE8BB11656D")>]
type IVsLanguageInfo =  interface end
public interface IVsLanguageInfo

IVsLanguageInfo 类型公开以下成员。

方法

  名称 说明
公共方法 GetCodeWindowManager 允许语言添加修饰到代码编辑器。
公共方法 GetColorizer 返回 colorizer。
公共方法 GetFileExtensions 返回属于该语言的文件扩展名。
公共方法 GetLanguageName 返回编程语言的名称。

页首

备注

请参见实现和/或调用的插图在该示例 Figures Language Service的此接口。

对实现者的说明

实现此接口可创建语言服务。 这是 PRIMARY LANGUAGE 服务接口和对于所有语言服务是必需的。

示例

这是此接口的实现的简单示例。

using Microsoft.VisualStudio;
using Microsoft.VisualStudio.TextManager.Interop;

namespace MyLanguagePackage
{
    class MyLanguageService : IVsLanguageInfo
    {
        public int GetCodeWindowManager(IVsCodeWindow pCodeWin,
                                        out IVsCodeWindowManager ppCodeWinMgr)
        {
            // MyCodeWindowManager class implements IVsCodeWindowManager.
            ppCodeWinMgr = new MyCodeWindowManager(pCodeWin);
            return VSConstants.S_OK;
        }


        public int GetColorizer(IVsTextLines pBuffer
                                out IVsColorizer ppColorizer)
        {
            // MyColorizer implements IVsColorizer
            ppColorizer = new MyColorizer(pBuffer);
            return VSConstants.S_OK;
        }


        public int GetFileExtensions(out string pbstrExtensions)
        {
            // This is the same extension the language service was
            // registered as supporting.
            pbstrExtensions = ".myext";
            return VSConstants.S_OK;
        }


        public int GetLanguageName(out string bstrName)
        {
            // This is the same name the language service was
            // registered with.
            bstrName = "MyLanguage";
            return VSConstants.S_OK;
        }
    }
}

请参阅

参考

Microsoft.VisualStudio.TextManager.Interop 命名空间