LanguageService.GetLanguageID Method (IVsTextBuffer, Int32, Int32, Guid)


Returns the language GUID of the language service.

Namespace:   Microsoft.VisualStudio.Package
Assembly:  Microsoft.VisualStudio.Package.LanguageService.14.0 (in Microsoft.VisualStudio.Package.LanguageService.14.0.dll)

public virtual int GetLanguageID(
	IVsTextBuffer buffer,
	int line,
	int col,
	out Guid langId


Type: Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer

[in] The IVsTextBuffer containing the source for which to get the language id.

Type: System.Int32

[in] The line index into the buffer to the source for which to get the language.

Type: System.Int32

[in] The character position in the line.

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.

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.

Return to top