次の方法で共有


IVsLanguageBlock.GetCurrentBlock Method

Definition

Determines the current span of the language block.

public:
 int GetCurrentBlock(Microsoft::VisualStudio::TextManager::Interop::IVsTextLines ^ pTextLines, int iCurrentLine, int iCurrentChar, cli::array <Microsoft::VisualStudio::TextManager::Interop::TextSpan> ^ ptsBlockSpan, [Runtime::InteropServices::Out] System::String ^ % pbstrDescription, [Runtime::InteropServices::Out] int % pfBlockAvailable);
int GetCurrentBlock(Microsoft::VisualStudio::TextManager::Interop::IVsTextLines const & pTextLines, int iCurrentLine, int iCurrentChar, std::Array <Microsoft::VisualStudio::TextManager::Interop::TextSpan> const & ptsBlockSpan, [Runtime::InteropServices::Out] std::wstring const & & pbstrDescription, [Runtime::InteropServices::Out] int & pfBlockAvailable);
public int GetCurrentBlock (Microsoft.VisualStudio.TextManager.Interop.IVsTextLines pTextLines, int iCurrentLine, int iCurrentChar, Microsoft.VisualStudio.TextManager.Interop.TextSpan[] ptsBlockSpan, out string pbstrDescription, out int pfBlockAvailable);
abstract member GetCurrentBlock : Microsoft.VisualStudio.TextManager.Interop.IVsTextLines * int * int * Microsoft.VisualStudio.TextManager.Interop.TextSpan[] * string * int -> int
Public Function GetCurrentBlock (pTextLines As IVsTextLines, iCurrentLine As Integer, iCurrentChar As Integer, ptsBlockSpan As TextSpan(), ByRef pbstrDescription As String, ByRef pfBlockAvailable As Integer) As Integer

Parameters

pTextLines
IVsTextLines

[in] An IVsTextLines object containing the text to examine.

iCurrentLine
Int32

[in] Current line position of the cursor.

iCurrentChar
Int32

[in] Current character position of the cursor within the line.

ptsBlockSpan
TextSpan[]

[out] Specifies a span of text representing the current language block. For more information, see TextSpan.

pbstrDescription
String

[out] Returns a string containing the description of the language block.

pfBlockAvailable
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.

Returns

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.

Applies to