IVsLanguageBlock.GetCurrentBlock Method
Determines the current span of the language block.
Namespace: Microsoft.VisualStudio.TextManager.Interop
Assembly: Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)
Syntax
'Declaration
Function GetCurrentBlock ( _
pTextLines As IVsTextLines, _
iCurrentLine As Integer, _
iCurrentChar As Integer, _
<OutAttribute> ptsBlockSpan As TextSpan(), _
<OutAttribute> ByRef pbstrDescription As String, _
<OutAttribute> ByRef pfBlockAvailable As Integer _
) As Integer
int GetCurrentBlock(
IVsTextLines pTextLines,
int iCurrentLine,
int iCurrentChar,
TextSpan[] ptsBlockSpan,
out string pbstrDescription,
out int pfBlockAvailable
)
int GetCurrentBlock(
[InAttribute] IVsTextLines^ pTextLines,
[InAttribute] int iCurrentLine,
[InAttribute] int iCurrentChar,
[OutAttribute] array<TextSpan>^ ptsBlockSpan,
[OutAttribute] String^% pbstrDescription,
[OutAttribute] int% pfBlockAvailable
)
abstract GetCurrentBlock :
pTextLines:IVsTextLines *
iCurrentLine:int *
iCurrentChar:int *
ptsBlockSpan:TextSpan[] byref *
pbstrDescription:string byref *
pfBlockAvailable:int byref -> int
function GetCurrentBlock(
pTextLines : IVsTextLines,
iCurrentLine : int,
iCurrentChar : int,
ptsBlockSpan : TextSpan[],
pbstrDescription : String,
pfBlockAvailable : int
) : int
Parameters
pTextLines
Type: Microsoft.VisualStudio.TextManager.Interop.IVsTextLines[in] An IVsTextLines object containing the text to examine.
iCurrentLine
Type: System.Int32[in] Current line position of the cursor.
iCurrentChar
Type: System.Int32[in] Current character position of the cursor within the line.
ptsBlockSpan
Type: array<Microsoft.VisualStudio.TextManager.Interop.TextSpan[][out] Specifies a span of text representing the current language block. For more information, see TextSpan.
pbstrDescription
Type: System.String%[out] Returns a string containing the description of the language block.
pfBlockAvailable
Type: System.Int32%[out, retval] Returns non-zero if the block is available. Otherwise, returns zero if the current cursor position does not coincide with a language block.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From textmgr.idl:
HRESULT IVsLanguageBlock::GetCurrentBlock(
[in] IVsTextLines * pTextLines,
[in] LONG iCurrentLine,
[in] LONG iCurrentChar,
[out] TextSpan * ptsBlockSpan,
[out] BSTR * pbstrDescription
);
Given the current position, this method returns a TextSpan structure that defines the enclosing or nearby block of text and a short description of the block.
This method is typically called from the view to populate the Find dialog box's "Search only: <current procedure>" option where <current procedure> is the pbstrDescription text. The description should be short due to limited space on the Find dialog box.
The pfBlockAvailable parameter must be set to non-zero when a block is available and zero when the position is outside any blocks. The values of the ptsBlockSpan and pbstrDescription parameters may be a null value indicating those parameters are not wanted by the caller.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.