共用方式為


LanguageService.GetLanguageID Method

Returns the language GUID of the language service.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)

Syntax

'宣告
Public Overridable Function GetLanguageID ( _
    buffer As IVsTextBuffer, _
    line As Integer, _
    col As Integer, _
    <OutAttribute> ByRef langId As Guid _
) As Integer
public virtual int GetLanguageID(
    IVsTextBuffer buffer,
    int line,
    int col,
    out Guid langId
)

Parameters

  • line
    Type: System.Int32
    [in] The line index into the buffer to the source for which to get the language.
  • col
    Type: System.Int32
    [in] The character position in the line.
  • langId
    Type: System.Guid%
    [out] Returns the GUID of the language for the associated source.

Return Value

Type: System.Int32
If successful, returns S_OK; otherwise, returns an error code.

Implements

IVsLanguageDebugInfo.GetLanguageID(IVsTextBuffer, Int32, Int32, Guid%)

Remarks

The supplied buffer object holds the entire source file. Some source files support mixed languages, for example JScript and VBScript embedded in an HTML page. This method is called to get the language ID for a particular debugger. If you support multiple languages in a source file, you must derive a class from the LanguageService class and override this method in your class.

The base method always calls LanguageService.GetLanguageServiceGuid which returns the GUID of the language service. This assumes the source file contains only a single language.

.NET Framework Security

See Also

Reference

LanguageService Class

Microsoft.VisualStudio.Package Namespace