Partager via


IVsLanguageInfo Interface

Retrieves information about a programming or markup language, including language name, associated file extension, and colorizer requirements for code editing.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)

Syntax

'Déclaration
<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

The IVsLanguageInfo type exposes the following members.

Methods

  Name Description
Public method GetCodeWindowManager Allows a language to add adornments to a code editor.
Public method GetColorizer Returns the colorizer.
Public method GetFileExtensions Returns the file extensions belonging to this language.
Public method GetLanguageName Returns the name of the programming language.

Top

Remarks

See illustrations of the implementation and/or calling of this interface in the sample Figures Language Service.

Notes to Implementers

Implement this interface to create your language service. This is the primary language service interface and is required for all language services.

Examples

Here is a simple example of an implementation of this interface.

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

See Also

Reference

Microsoft.VisualStudio.TextManager.Interop Namespace