共用方式為


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

Definition

Returns the language GUID of the language service.

public:
 virtual int GetLanguageID(Microsoft::VisualStudio::TextManager::Interop::IVsTextBuffer ^ buffer, int line, int col, [Runtime::InteropServices::Out] Guid % langId);
public virtual int GetLanguageID (Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer buffer, int line, int col, out Guid langId);
abstract member GetLanguageID : Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer * int * int * Guid -> int
override this.GetLanguageID : Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer * int * int * Guid -> int
Public Overridable Function GetLanguageID (buffer As IVsTextBuffer, line As Integer, col As Integer, ByRef langId As Guid) As Integer

Parameters

buffer
IVsTextBuffer

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

line
Int32

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

col
Int32

[in] The character position in the line.

langId
Guid

[out] Returns the GUID of the language for the associated source.

Returns

If successful, returns S_OK; otherwise, returns an error code.

Implements

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 Microsoft.VisualStudio.Package.LanguageService.GetLanguageServiceGuid which returns the GUID of the language service. This assumes the source file contains only a single language.

Applies to