共用方式為


IVsExpansionClient.IsValidKind Method

Definition

Called to verify that the specified location can accept the specified kind of snippet.

public:
 int IsValidKind(Microsoft::VisualStudio::TextManager::Interop::IVsTextLines ^ pBuffer, cli::array <Microsoft::VisualStudio::TextManager::Interop::TextSpan> ^ ts, System::String ^ bstrKind, [Runtime::InteropServices::Out] int % pfIsValidKind);
int IsValidKind(Microsoft::VisualStudio::TextManager::Interop::IVsTextLines const & pBuffer, std::Array <Microsoft::VisualStudio::TextManager::Interop::TextSpan> const & ts, std::wstring const & bstrKind, [Runtime::InteropServices::Out] int & pfIsValidKind);
public int IsValidKind (Microsoft.VisualStudio.TextManager.Interop.IVsTextLines pBuffer, Microsoft.VisualStudio.TextManager.Interop.TextSpan[] ts, string bstrKind, out int pfIsValidKind);
abstract member IsValidKind : Microsoft.VisualStudio.TextManager.Interop.IVsTextLines * Microsoft.VisualStudio.TextManager.Interop.TextSpan[] * string * int -> int
Public Function IsValidKind (pBuffer As IVsTextLines, ts As TextSpan(), bstrKind As String, ByRef pfIsValidKind 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.

bstrKind
String

[in] A string that specifies the kind of code snippet that is to be inserted. See Remarks.

pfIsValidKind
Int32

[out] Non-zero (TRUE) if the code snippet can be inserted into the specified location based on its kind; 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::IsValidKind(  
   [in]IVsTextLines *pBuffer,  
   [in]TextSpan *ts,  
   [in]BSTR bstrKind  
);  

The bstrKind parameter is a string that specifies the kinds of snippets to display, such as MethodBody, Page, and File. The snippet kind can control in what context the snippet is inserted. For example, a snippet kind of MethodBody should be inserted only in a method. See Code Element (Intellisense Code Snippets) for a list of all snippet kinds that are supported. It is possible for a code snippet to not have a kind associated with it in which case the bstrKind parameter is an empty string.

Applies to