IVsLanguageBlock::GetCurrentBlock Method (IVsTextLines^, Int32, Int32, array<TextSpan>^, String^, Int32)

 

Determines the current span of the language block.

Namespace:   Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)

int GetCurrentBlock(
	IVsTextLines^ pTextLines,
	int iCurrentLine,
	int iCurrentChar,
	array<TextSpan>^ ptsBlockSpan,
	[OutAttribute] String^% pbstrDescription,
	[OutAttribute] int% pfBlockAvailable
)

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.

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.

Return to top
Show: