Compartilhar via


IVsExpansionClient.IsValidType Method

Definition

Called to verify that the specified location can accept the specified types of code snippets.

public:
 int IsValidType(Microsoft::VisualStudio::TextManager::Interop::IVsTextLines ^ pBuffer, cli::array <Microsoft::VisualStudio::TextManager::Interop::TextSpan> ^ ts, cli::array <System::String ^> ^ rgTypes, int iCountTypes, [Runtime::InteropServices::Out] int % pfIsValidType);
int IsValidType(Microsoft::VisualStudio::TextManager::Interop::IVsTextLines const & pBuffer, std::Array <Microsoft::VisualStudio::TextManager::Interop::TextSpan> const & ts, std::Array <std::wstring const &> const & rgTypes, int iCountTypes, [Runtime::InteropServices::Out] int & pfIsValidType);
public int IsValidType (Microsoft.VisualStudio.TextManager.Interop.IVsTextLines pBuffer, Microsoft.VisualStudio.TextManager.Interop.TextSpan[] ts, string[] rgTypes, int iCountTypes, out int pfIsValidType);
abstract member IsValidType : Microsoft.VisualStudio.TextManager.Interop.IVsTextLines * Microsoft.VisualStudio.TextManager.Interop.TextSpan[] * string[] * int * int -> int
Public Function IsValidType (pBuffer As IVsTextLines, ts As TextSpan(), rgTypes As String(), iCountTypes As Integer, ByRef pfIsValidType As Integer) As Integer

Parameters

pBuffer
IVsTextLines

[in] An IVsTextLines object that represents the text buffer where the code snippet is to be inserted.

ts
TextSpan[]

[in] A TextSpan object that describes the location where the code snippet is to be inserted.

rgTypes
String[]

[in] An array strings specifying the types of the code snippet to be inserted. This can be a null value if iCountTypes is 0. See Remarks.

iCountTypes
Int32

[in] The number of types specified in the rgTypes array.

pfIsValidType
Int32

[out] Non-zero (TRUE) if the code snippet can be inserted into the specified location based on its types; zero (FALSE) if the code snippet cannot be inserted.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From textmgr2.idl:

bool IVsExpansionClient::IsValidType(  
   [in]IVsTextLines *pBuffer,  
   [in]TextSpan *ts,  
   [in, size_is(iCountTypes)]BSTR* rgTypes,  
   [in] int iCountTypes  
);  

The rgTypes list contains strings that specify the types of snippets to display. These types can be "Expansion" or "SurroundsWith" (see SnippetType Element (Intellisense Code Snippets) for details on snippet types). It is possible for a code snippet to not have a type associated with it, in which case the iCountTypes parameter is 0.

Applies to