本文整理汇总了C#中ICompletionData.InsertAction方法的典型用法代码示例。如果您正苦于以下问题:C# ICompletionData.InsertAction方法的具体用法?C# ICompletionData.InsertAction怎么用?C# ICompletionData.InsertAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICompletionData
的用法示例。
在下文中一共展示了ICompletionData.InsertAction方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertAction
public bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
{
textArea.Caret.Position = textArea.Document.OffsetToPosition(
Math.Min(insertionOffset, textArea.Document.TextLength));
return data.InsertAction(textArea, key);
}
示例2: InsertAction
public virtual bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
{
if (InsertSpace)
{
textArea.Document.Insert(insertionOffset++, " ");
}
textArea.Caret.Position = textArea.Document.OffsetToPosition(insertionOffset);
return data.InsertAction(textArea, key);
}
示例3: InsertAction
/// <summary>
/// Called when entry should be inserted. Forward to the insertion action of the completion data.
/// </summary>
public bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key) {
int endOffset = insertionOffset;
LineSegment line = textArea.Document.GetLineSegment(textArea.Caret.Line);
// Try to find the last word and replace it
if (insertionOffset != 0) {
// insertionOffset represent the current Caret, so this isnt needed
// But just in case..
if (textArea.Caret.Column > 0) {
TextWord word = line.GetWord(textArea.Caret.Column - 1);
if (word != null) {
// Nothing todo?
if (word.Word == data.Text) {
data.Text = "";
} else {
// cap insert data
data.Text = data.Text.Substring(word.Length);
}
}
}
}
return data.InsertAction(textArea, key);
}
示例4: InsertAction
/// <summary>
/// Inserts the selected completion value.
/// </summary>
/// <remarks>
/// If we are closing a tag, we request a reformatting of the line.
/// </remarks>
/// <param name="p_cdtData">The code completion selection that was chosen.</param>
/// <param name="p_txaTextArea">The area containing the document being edited.</param>
/// <param name="p_intInsertionOffset">Where the selection should be inserted into the document.</param>
/// <param name="p_chrKey">The character that was used to choose this completion selection.</param>
/// <returns><lang cref="true"/> if the insertion of <paramref name="p_chrKey"/> was handled;
/// <lang cref="false"/> otherwise.</returns>
public bool InsertAction(ICompletionData p_cdtData, TextArea p_txaTextArea, int p_intInsertionOffset, char p_chrKey)
{
p_txaTextArea.Caret.Position = p_txaTextArea.Document.OffsetToPosition(p_intInsertionOffset);
bool booInserted = p_cdtData.InsertAction(p_txaTextArea, p_chrKey);
if (p_cdtData.Text.StartsWith("/"))
{
p_txaTextArea.Document.FormattingStrategy.IndentLine(p_txaTextArea, p_txaTextArea.Caret.Position.Line);
if (p_chrKey == '/')
return true;
}
return booInserted;
}
示例5: InsertAction
/// <summary>
/// Called when entry should be inserted. Forward to the insertion action of the completion data.
/// </summary>
public bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
{
textArea.Caret.Position = textArea.Document.OffsetToPosition(insertionOffset);
if (!(data as UserDefaultCompletionData).IsOnOverrideWindow)
{
int ind = data.Text.IndexOf('<');
if (ind != -1 && data.Text.Length > ind + 1 && data.Text[ind + 1] == '>') data.Text = data.Text.Substring(0, ind);
}
else
data.Text = data.Description;
return data.InsertAction(textArea, key);
}
示例6: InsertAction
public bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
{
if (this.InsertSpace)
{
textArea.Document.Insert(insertionOffset++, " ");
}
textArea.Caret.Position = textArea.Document.OffsetToPosition(insertionOffset);
var res = data.InsertAction(textArea, key);
var fdoComp = (FdoCompletionData)data;
if (fdoComp.ImageIndex == 0 && fdoComp.AppendText.Length > 2) //Function and not an empty function call
{
//Rewind caret so it is at the start of the function call (at first parameter)
var offset = textArea.Caret.Offset;
offset -= (fdoComp.AppendText.Length - 1);
textArea.Caret.Position = textArea.Document.OffsetToPosition(offset);
textArea.SelectionManager.ClearSelection();
textArea.SelectionManager.SetSelection(textArea.Caret.Position, textArea.Document.OffsetToPosition(offset + (fdoComp.HighlightLength - 1)));
}
return res;
}
示例7: InsertAction
/// <summary>
/// Called when entry should be inserted. Forward to the insertion action of the completion data.
/// </summary>
public bool InsertAction(ICompletionData data, TextArea textArea, int insertionOffset, char key)
{
textArea.SelectionManager.SetSelection(textArea.Document.OffsetToPosition(
Math.Min(insertionOffset - ((AEGISCompletionData)data).Expression.Length, textArea.Document.TextLength)
), textArea.Caret.Position);
return data.InsertAction(textArea, key);
}