Partager via


LanguageService.GetNameOfLocation Method

Definition

Returns the name of the enclosing element that contains the given position.

public:
 virtual int GetNameOfLocation(Microsoft::VisualStudio::TextManager::Interop::IVsTextBuffer ^ buffer, int line, int col, [Runtime::InteropServices::Out] System::String ^ % name, [Runtime::InteropServices::Out] int % lineOffset);
 virtual int GetNameOfLocation(Microsoft::VisualStudio::TextManager::Interop::IVsTextBuffer const & buffer, int line, int col, [Runtime::InteropServices::Out] std::wstring const & & name, [Runtime::InteropServices::Out] int & lineOffset);
public virtual int GetNameOfLocation (Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer buffer, int line, int col, out string name, out int lineOffset);
abstract member GetNameOfLocation : Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer * int * int * string * int -> int
override this.GetNameOfLocation : Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer * int * int * string * int -> int
Public Overridable Function GetNameOfLocation (buffer As IVsTextBuffer, line As Integer, col As Integer, ByRef name As String, ByRef lineOffset As Integer) As Integer

Parameters

buffer
IVsTextBuffer

[in] The IVsTextBuffer holding the source file.

line
Int32

[in] The desired line in the buffer.

col
Int32

[in] The desired offset on the line in the buffer.

name
String

[out] The name of the enclosing element.

lineOffset
Int32

[out] The offset from the start of the enclosing element to the given line.

Returns

If successful, returns S_OK; otherwise, returns S_FALSE if the location is not within a named entity or returns an error code.

Implements

Remarks

An enclosing element is typically a method, class, or namespace.

The base method returns a null value for the name and 0 for the line offset.

Applies to