本文整理汇总了C#中ICSharpCode.AvalonEdit.CodeCompletion.CompletionWindow.Show方法的典型用法代码示例。如果您正苦于以下问题:C# CompletionWindow.Show方法的具体用法?C# CompletionWindow.Show怎么用?C# CompletionWindow.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.AvalonEdit.CodeCompletion.CompletionWindow
的用法示例。
在下文中一共展示了CompletionWindow.Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Complete
public void Complete(TextArea textArea, ISegment completionSegment,
EventArgs insertionRequestEventArgs)
{
textArea.Document.Replace(completionSegment, this.Text);
if (autocompleteAgain_)
{
var completionWindow = new CompletionWindow(textArea);
completionWindow.Width = 256;
IList<ICompletionData> data = completionWindow.CompletionList.CompletionData;
var functions = App.MainViewModel.AutoCompleteCache.GetFunctions(Content as string);
(functions as List<ErlangEditor.AutoComplete.AcEntity>).Sort(new Tools.Reverser<ErlangEditor.AutoComplete.AcEntity>(new AutoComplete.AcEntity().GetType(), "FunctionName", Tools.ReverserInfo.Direction.ASC));
foreach (var i in functions)
{
data.Add(new CompletionData(false) { Text = "\'" + i.FunctionName + "\'(", Content = i.FunctionName + "/" + i.Arity, Description = i.Desc });
}
completionWindow.Show();
completionWindow.Closed += delegate
{
completionWindow = null;
};
}
}
示例2: InvokeCompletionWindow
public static void InvokeCompletionWindow(TextEditor textEditor)
{
completionWindow = new CompletionWindow(textEditor.TextArea);
completionWindow.Closed += delegate
{
completionWindow = null;
};
var text = textEditor.Text;
var offset = textEditor.TextArea.Caret.Offset;
var completedInput = CommandCompletion.CompleteInput(text, offset, null, PSConsolePowerShell.PowerShellInstance);
// var r = CommandCompletion.MapStringInputToParsedInput(text, offset);
"InvokeCompletedInput".ExecuteScriptEntryPoint(completedInput.CompletionMatches);
if (completedInput.CompletionMatches.Count > 0)
{
completedInput.CompletionMatches.ToList()
.ForEach(record =>
{
completionWindow.CompletionList.CompletionData.Add(
new CompletionData
{
CompletionText = record.CompletionText,
ToolTip = record.ToolTip,
Resultype = record.ResultType,
ReplacementLength = completedInput.ReplacementLength
});
});
completionWindow.Show();
}
}
示例3: textEditor_TextEntered
private void textEditor_TextEntered(object sender, TextCompositionEventArgs e)
{
if (e.Text == "<" || e.Text == " ")
{
CompletionData[] completions1;
if (completions.TryGetValue("!" + e.Text + "!" + GetActiveElement(1), out completions1))
{
completionWindow = new CompletionWindow(textEditor.TextArea);
var completions2 = completionWindow.CompletionList.CompletionData;
foreach (var completion in completions1)
completions2.Add(completion);
completionWindow.Show();
completionWindow.Closed += delegate
{
completionWindow = null;
};
}
}
if (e.Text == ">")
{
var tag = GetOpenTag(1);
if (tag != string.Empty)
textEditor.Document.Insert(textEditor.CaretOffset, tag.Insert(1, "/") + ">");
}
}
示例4: ShowCompletionWindow
/// <summary>
/// Shows completion window for passed functions.
/// </summary>
/// <param name="identifierSegment">optional segment that should be included in the progressive search: eg. part of an identifier that's already typed before code completion was started</param>
/// <param name="functions"></param>
public void ShowCompletionWindow(ISegment identifierSegment, IList<Function> functions)
{
FunctionCompletionData first = null;
_completionWindow = new CompletionWindow(textEditor.TextArea);
foreach (var function in functions)
{
var tooltip = string.IsNullOrWhiteSpace(function.Definition) ? function.Description : string.Format("{0}\n\n{1}", function.Definition.Replace("|", Environment.NewLine), function.Description);
var item = new FunctionCompletionData(function.Name, tooltip);
if (first == null) first = item;
_completionWindow.CompletionList.CompletionData.Add(item);
}
_completionWindow.StartOffset = identifierSegment.Offset;
_completionWindow.EndOffset = identifierSegment.EndOffset;
if (first != null)
{
_completionWindow.CompletionList.SelectedItem = first;
}
_completionWindow.Show();
_completionWindow.Closed += (sender, args) => _completionWindow = null;
_completionWindow.PreviewTextInput += (sender, args) =>
{
if (args.Text == "(")
{
_completionWindow.CompletionList.RequestInsertion(EventArgs.Empty);
}
var c = args.Text[args.Text.Length - 1];
args.Handled = !char.IsLetterOrDigit(c) && c != '_';
};
}
示例5: Resolve
public CompletionWindow Resolve()
{
var hiName = string.Empty;
if (_target.SyntaxHighlighting != null)
{
hiName = _target.SyntaxHighlighting.Name;
}
var cdata = _dataProviders.SelectMany(x => x.GetData(_text, _position, _input, hiName)).ToList();
int count = cdata.Count;
if (count > 0)
{
var completionWindow = new CompletionWindow(_target.TextArea);
var data = completionWindow.CompletionList.CompletionData;
foreach (var completionData in cdata)
{
data.Add(completionData);
}
completionWindow.Show();
completionWindow.Closed += delegate
{
completionWindow = null;
};
return completionWindow;
}
return null;
}
示例6: AttributeCompletionAvailable
private void AttributeCompletionAvailable(object sender, AttributeCompletionEventArgs e)
{
_completionWindow = new CompletionWindow(txtPlugin.TextArea);
IList<ICompletionData> data = _completionWindow.CompletionList.CompletionData;
foreach (CompletableXMLAttribute tag in e.Suggestions)
data.Add(new XMLAttributeCompletionData(tag, _completer));
_completionWindow.Show();
}
示例7: ShowCompletion
public void ShowCompletion(TextArea area)
{
var window = new CompletionWindow(area);
IList<ICompletionData> data = window.CompletionList.CompletionData;
foreach (CompletionData item in GenerateCompletionData("test.boo", area))
{
data.Add(item);
}
window.Show();
}
示例8: TextEditorTextAreaTextEntered
public void TextEditorTextAreaTextEntered(object sender, TextCompositionEventArgs e)
{
if (e.Text == ".")
{
// Open code completion after the user has pressed dot:
_completionWindow = new CompletionWindow(sender as TextArea);
IList<ICompletionData> data = _completionWindow.CompletionList.CompletionData;
data.Add(new MyCompletionData("Query"));
data.Add(new MyCompletionData("All()"));
data.Add(new MyCompletionData("ToString()"));
_completionWindow.Show();
_completionWindow.Closed += delegate { _completionWindow = null; };
}
}
示例9: edSQL_TextArea_Sense
private void edSQL_TextArea_Sense(object sender, TextCompositionEventArgs e)
{
completionWindow = new CompletionWindow(edSQL.TextArea);
IList<ICompletionData> data = completionWindow.CompletionList.CompletionData;
// fill data (completion options) based on e (position, context etc)
completionHelper.Initialize(e, data);
completionWindow.Show();
completionWindow.CompletionList.IsFiltering = false;
completionWindow.CompletionList.SelectItem(completionHelper.Currentword);
completionWindow.Closed += delegate
{
completionWindow = null;
};
}
示例10: textEditor_TextArea_TextEntered
void textEditor_TextArea_TextEntered(object sender, TextCompositionEventArgs e)
{
if (e.Text == ".")
{
// open code completion after the user has pressed dot:
completionWindow = new CompletionWindow(textEditor.TextArea);
// provide AvalonEdit with the data:
IList<ICompletionData> data = completionWindow.CompletionList.CompletionData;
data.Add(new MyCompletionData("zapline"));
data.Add(new MyCompletionData("is"));
data.Add(new MyCompletionData("a"));
data.Add(new MyCompletionData("sb"));
completionWindow.Show();
completionWindow.Closed += delegate
{
completionWindow = null;
};
}
}
示例11: ShowCompletionWindow
private async Task ShowCompletionWindow()
{
if (Recommender == null) return;
_completionWindow = new CompletionWindow(TextArea);
var data = _completionWindow.CompletionList.CompletionData;
var list = await Recommender.GetCompletionData(Text, TextArea.Caret.Offset - 1);
foreach (var item in list)
{
data.Add(item);
}
if (0 < data.Count)
{
_completionWindow.Show();
_completionWindow.Closed += (obj, e) => _completionWindow = null;
}
else
{
_completionWindow = null;
}
}
示例12: Complete
public CommandResult Complete(WishArgs wishArgs)
{
var command = _repl.Read(wishArgs.TextEditor.Text);
var args = command.Arguments.ToList();
string completionTarget;
List<string> completions;
if(args.Any())
{
var arg = args.Last();
completionTarget = arg.PartialPath.CompletionTarget;
completions = command.Complete().ToList();
}
else
{
completionTarget = command.Function.Name;
completions = command.Function.Complete().ToList();
}
if(completions.Count() == 0) return new CommandResult { FullyProcessed = true, Handled = true };
_completionWindow = new CompletionWindow(wishArgs.TextEditor.TextArea)
{
SizeToContent = SizeToContent.WidthAndHeight,
MinWidth = 150
};
var completionData = _completionWindow.CompletionList.CompletionData;
foreach (var completion in completions)
{
completionData.Add(new CompletionData(completionTarget, completion));
}
if (completionData.Count == 0) return new CommandResult { FullyProcessed = true, Handled = true };
_completionWindow.Show();
_completionWindow.Closed += delegate
{
wishArgs.OnClosed.Invoke();
_completionWindow = null;
};
return new CommandResult{ FullyProcessed = true, Handled = false, State = Common.State.Tabbing };
}
示例13: showCodeCompletion
protected void showCodeCompletion(DomParser.KeysCommand cmd)
{
if(completionWindow != null) {
return;
}
if(dom == null) {
Log.Debug("Use the codeCompletionInit() for work with Code Completion");
return;
}
IEnumerable<ICompletionData> data = dom.find(_.TextArea.Document.Text, _.TextArea.Caret.Offset, cmd);
if(data == null) {
return;
}
completionWindow = new CompletionWindow(_.TextArea) { Width = 270 };
completionWindow.Closed += delegate {
completionWindow = null;
};
foreach(ICompletionData item in data) {
completionWindow.CompletionList.CompletionData.Add(item);
}
completionWindow.Show();
}
示例14: textEditor_TextArea_TextEntered
//Executed after key press
void textEditor_TextArea_TextEntered(object sender, TextCompositionEventArgs e)
{
if (e.Text == ".") {
// open code completion after the user has pressed dot:
completionWindow = new CompletionWindow(textEditor.TextArea);
// provide AvalonEdit with the data:
IList<ICompletionData> data = completionWindow.CompletionList.CompletionData;
data.Add(new MyCompletionData("Item1"));
data.Add(new MyCompletionData("Item2"));
data.Add(new MyCompletionData("Item3"));
data.Add(new MyCompletionData("Another item"));
completionWindow.Show();
completionWindow.Closed += delegate {
completionWindow = null;
};
}
if (e.Text == "\n") {
if (textualContent.LogOrPrintResult() == TextualContent.LogOrPrint.print) {
writeText(textualContent.OutputString);
} if (textualContent.LogOrPrintResult() == TextualContent.LogOrPrint.log) {
printText(textualContent.OutputString);
}
}
}
示例15: TextEntered
private void TextEntered(object sender, TextCompositionEventArgs e)
{
UpdateUndoRedoEnabled();
if (e.Text == "<")
{
m_completionWindow = new CompletionWindow(textEditor.TextArea);
dynamic data = m_completionWindow.CompletionList.CompletionData;
data.Add(new CompletionData("object"));
data.Add(new CompletionData("command"));
m_completionWindow.Show();
m_completionWindow.Closed += m_completionWindow_Closed;
}
}