共用方式為


IVsLanguageInfo Interface

Definition

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

public interface class IVsLanguageInfo
public interface class IVsLanguageInfo
__interface IVsLanguageInfo
[System.Runtime.InteropServices.Guid("11DDB920-52C7-4237-8610-9FE8BB11656D")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IVsLanguageInfo
[System.Runtime.InteropServices.Guid("11DDB920-52C7-4237-8610-9FE8BB11656D")]
[System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
public interface IVsLanguageInfo
[<System.Runtime.InteropServices.Guid("11DDB920-52C7-4237-8610-9FE8BB11656D")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IVsLanguageInfo = interface
[<System.Runtime.InteropServices.Guid("11DDB920-52C7-4237-8610-9FE8BB11656D")>]
[<System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)>]
type IVsLanguageInfo = interface
Public Interface IVsLanguageInfo
Derived
Attributes

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

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.

Methods

GetCodeWindowManager(IVsCodeWindow, IVsCodeWindowManager)

Allows a language to add adornments to a code editor.

GetColorizer(IVsTextLines, IVsColorizer)

Returns the colorizer.

GetFileExtensions(String)

Returns the file extensions belonging to this language.

GetLanguageName(String)

Returns the name of the programming language.

Applies to