CompletionSet.OnCommit 方法

因此,如果指定的字符是使字符,获取文本插入到源文件。

命名空间:  Microsoft.VisualStudio.Package
程序集:   Microsoft.VisualStudio.Package.LanguageService.11.0(在 Microsoft.VisualStudio.Package.LanguageService.11.0.dll 中)
  Microsoft.VisualStudio.Package.LanguageService.10.0(在 Microsoft.VisualStudio.Package.LanguageService.10.0.dll 中)
  Microsoft.VisualStudio.Package.LanguageService(在 Microsoft.VisualStudio.Package.LanguageService.dll 中)
  Microsoft.VisualStudio.Package.LanguageService.9.0(在 Microsoft.VisualStudio.Package.LanguageService.9.0.dll 中)

语法

声明
Public Overridable Function OnCommit ( _
    textSoFar As String, _
    index As Integer, _
    selected As Integer, _
    commitChar As UShort, _
    <OutAttribute> ByRef completeWord As String _
) As Integer
public virtual int OnCommit(
    string textSoFar,
    int index,
    int selected,
    ushort commitChar,
    out string completeWord
)

参数

  • textSoFar
    类型:System.String
    [in] 包含目前由用户键入的文本的字符串。
  • index
    类型:System.Int32
    [in] 项的索引在当前选定的项的列表。
  • selected
    类型:System.Int32
    [in] 非零,如果项目在已选择完成项列表 (选定项的索引。 index 参数)。如果此参数为零, index 参数将被忽略。
  • commitChar
    类型:System.UInt16
    [in] 触发完成的类型化字符列表。
  • completeWord
    类型:System.String%
    [in] 返回字符串到数据源的插入。

返回值

类型:System.Int32
如果成功,则返回 S_OK。如果 commitChar 参数不是让字符,返回 S_FALSE (不要提交该文本写入源文件);否则,返回错误代码。

实现

IVsCompletionSet.OnCommit(String, Int32, Int32, UInt16, String%)

备注

此方法确定特定字符是否是使字符如果是这样,确定要生成的文本根据在完成选择的项列表。如果字符不是让字符至此,此方法返回类型的文本。

此方法是 OnCommit 方法的实现。 IVsCompletionSet 接口的。

如果 commitChar 参数不是 0,则基方法检查在 Declarations 对象的项目才能看到 commitChar 参数是否采用到类型化的文本可能的匹配项包含到目前为止 (如果可能使出现一个到目前为止,在输入任何声明该文本,字符不能是使字符)。如果 commitChar 参数可以是物理环境中进行字符,该基方法调用 Declarations 对象的 IsCommitChar 使最终确定。

如果 commitChar 参数为 0 或被认为是实际进行字符,该基方法调用 Declarations 对象的 OnCommit 方法获取选定项的文本。最后,该基方法返回文本以及成功与否代码, S_OK。如果 commitChar 参数不是让字符,该基方法返回 S_FALSE

.NET Framework 安全性

请参见

参考

CompletionSet 类

Microsoft.VisualStudio.Package 命名空间