本文整理汇总了C#中ICSharpCode.AvalonEdit.CodeCompletion.CompletionWindow类的典型用法代码示例。如果您正苦于以下问题:C# CompletionWindow类的具体用法?C# CompletionWindow怎么用?C# CompletionWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompletionWindow类属于ICSharpCode.AvalonEdit.CodeCompletion命名空间,在下文中一共展示了CompletionWindow类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
};
}
}
开发者ID:xdusongwei,项目名称:ErlangEditor,代码行数:23,代码来源:CompleteData.cs
示例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();
}
}
开发者ID:dfinke,项目名称:PowerShellConsole,代码行数:35,代码来源:TextEditorUtilities.cs
示例3: 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 != '_';
};
}
开发者ID:thomasvt,项目名称:EffectEd,代码行数:34,代码来源:HlslEdit.xaml.cs
示例4: 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, "/") + ">");
}
}
开发者ID:hungdluit,项目名称:sipserver,代码行数:27,代码来源:EditXmlConfig.xaml.cs
示例5: OnTextEntered
private void OnTextEntered(object sender, TextCompositionEventArgs e)
{
if (CaretOffset <= 0) return;
var isTrigger = _scriptManager.IsCompletionTriggerCharacter(CaretOffset - 1);
if (!isTrigger) return;
_completionWindow = new CompletionWindow(TextArea);
var data = _completionWindow.CompletionList.CompletionData;
var completion = _scriptManager.GetCompletion(CaretOffset, Text[CaretOffset - 1]).ToList();
if (!completion.Any())
{
_completionWindow = null;
return;
}
foreach (var completionData in completion)
{
data.Add(new CompletionData(completionData));
}
_completionWindow.Show();
_completionWindow.Closed += (o, args) => _completionWindow = null;
}
开发者ID:Wagnerp,项目名称:scriptcs-editor,代码行数:26,代码来源:ScriptEditor.cs
示例6: 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;
}
开发者ID:tym32167,项目名称:dotnetnotepad,代码行数:31,代码来源:CompletionWindowResolver.cs
示例7: ScriptEditDialog
public ScriptEditDialog(string text) : base("Script edit", "cde.ico", SizeToContent.Manual, ResizeMode.CanResize) {
InitializeComponent();
Extensions.SetMinimalSize(this);
AvalonLoader.Load(_textEditor);
AvalonLoader.SetSyntax(_textEditor, "Script");
string script = ItemParser.Format(text, 0);
_textEditor.Text = script;
_textEditor.TextArea.TextEntered += new TextCompositionEventHandler(_textArea_TextEntered);
_textEditor.TextArea.TextEntering += new TextCompositionEventHandler(_textArea_TextEntering);
_completionWindow = new CompletionWindow(_textEditor.TextArea);
_li = _completionWindow.CompletionList;
ListView lv = _li.ListBox;
lv.SelectionMode = SelectionMode.Single;
//Image
Extensions.GenerateListViewTemplate(lv, new ListViewDataTemplateHelper.GeneralColumnInfo[] {
new ListViewDataTemplateHelper.ImageColumnInfo { Header = "", DisplayExpression = "Image", TextAlignment = TextAlignment.Center, FixedWidth = 22, MaxHeight = 22, SearchGetAccessor = "Commands"},
new ListViewDataTemplateHelper.GeneralColumnInfo {Header = "Commands", DisplayExpression = "Text", TextAlignment = TextAlignment.Left, IsFill = true, ToolTipBinding = "Description"}
}, null, new string[] { }, "generateHeader", "false");
_completionWindow.Content = null;
_completionWindow = null;
WindowStartupLocation = WindowStartupLocation.CenterOwner;
}
开发者ID:Tokeiburu,项目名称:RagnarokSDE,代码行数:28,代码来源:ScriptEditDialog.xaml.cs
示例8: 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();
}
开发者ID:ChadSki,项目名称:Assembly,代码行数:10,代码来源:PluginEditor.xaml.cs
示例9: SetupCompletionWindow
protected void SetupCompletionWindow(TextArea area)
{
this._c = new CompletionWindow(area);
this._c.SizeToContent = System.Windows.SizeToContent.WidthAndHeight;
this._c.CompletionList.InsertionRequested += new EventHandler(CompletionList_InsertionRequested);
this._c.CloseAutomatically = true;
this._c.CloseWhenCaretAtBeginning = true;
this._c.Closed += new EventHandler(this.CompletionWindowClosed);
this._c.KeyDown += new KeyEventHandler(CompletionWindowKeyDown);
this._startOffset = this._c.StartOffset;
}
开发者ID:almostEric,项目名称:DotNetRDF-4.0,代码行数:11,代码来源:BaseAutoCompleter.cs
示例10: 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();
}
开发者ID:tiwariritesh7,项目名称:devdefined-tools,代码行数:13,代码来源:CompletionManager.cs
示例11: 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; };
}
}
开发者ID:khebbie,项目名称:Dynamicpad,代码行数:14,代码来源:TextAreaCompletion.xaml.cs
示例12: textEditor_TextArea_TextEntered
private void textEditor_TextArea_TextEntered(object sender, TextCompositionEventArgs e)
{
if (e.Text != ".") return;
// open code completion after the user has pressed dot:
completionWindow = new CompletionWindow(TextEditor.TextArea);
// provide AvalonEdit with the data:
var 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; };
}
开发者ID:Dessix,项目名称:TUM.CMS.VPLControl,代码行数:14,代码来源:ScriptingControlSimple.xaml.cs
示例13: CreateNewCompletionWindow
CompletionWindow CreateNewCompletionWindow() {
if(_completionWindow != null)
_completionWindow.Close();
_completionWindow = new CompletionWindow(_texteditor.TextArea);
//_completionWindow.CompletionList.IsFiltering = false;
_completionWindow.StartOffset -= 1;
_completionWindow.Closed += delegate
{
_completionWindow = null;
};
return _completionWindow;
}
开发者ID:RaptorOne,项目名称:SmartDevelop,代码行数:15,代码来源:CompletionDataProviderAHK.cs
示例14: OpenCompletionWindow
private void OpenCompletionWindow(IEnumerable<CompletionData> completions)
{
if (this._completionWindow != null) return;
var wnd = new CompletionWindow(this.TextArea);
wnd.Closed += (o, e) =>
{
if (this._completionWindow == wnd)
this._completionWindow = null;
};
var elems = wnd.CompletionList.CompletionData;
completions.ForEach(wnd.CompletionList.CompletionData.Add);
// insert elements
this._completionWindow = wnd;
wnd.Show();
}
开发者ID:kissge,项目名称:StarryEyes,代码行数:15,代码来源:QueryEditor.cs
示例15: 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;
};
}
开发者ID:GDKsoftware,项目名称:QueryDesk,代码行数:15,代码来源:QueryEdit.xaml.cs
示例16: 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;
};
}
}
开发者ID:xxy1991,项目名称:cozy,代码行数:19,代码来源:SqlInput.xaml.cs
示例17: 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;
}
}
开发者ID:degarashi0913,项目名称:FAManagementStudio,代码行数:20,代码来源:BindableEditor.cs
示例18: _update
private void _update() {
// Open code completion after the user has pressed dot:
if (_completionWindow == null || !_completionWindow.IsVisible) {
if (_li.Parent != null) {
((CompletionWindow)_li.Parent).Content = null;
}
_completionWindow = new CompletionWindow(_textEditor.TextArea, _li);
_completionWindow.Changed += new EventHandler(_completionWindow_Changed);
_completionWindow.Closed += delegate {
if (_completionWindow != null) _completionWindow.Content = null;
_completionWindow = null;
};
}
RangeObservableCollectionX<ICompletionData> data = (RangeObservableCollectionX<ICompletionData>)_li.CompletionData;
data.Clear();
string word = AvalonLoader.GetWholeWord(_textEditor.TextArea.Document, _textEditor);
List<string> words = ScriptEditorList.Words.Where(p => p.IndexOf(word, StringComparison.OrdinalIgnoreCase) != -1).OrderBy(p => p).ToList();
List<string> constants = ScriptEditorList.Constants.Where(p => p.IndexOf(word, StringComparison.OrdinalIgnoreCase) != -1).OrderBy(p => p).ToList();
if (words.Count == 0 && constants.Count == 0) {
_completionWindow.Close();
return;
}
IEnumerable<ICompletionData> results = words.Select(p => (ICompletionData)new MyCompletionData(p, _textEditor, DataType.Function)).
Concat(constants.Select(p => (ICompletionData)new MyCompletionData(p, _textEditor, DataType.Constant)));
data.AddRange(results);
_completionWindow.CompletionList.ListBox.ItemsSource = data;
_completionWindow.Show();
_completionWindow.CompletionList.SelectedItem = _completionWindow.CompletionList.CompletionData.FirstOrDefault(p => String.Compare(p.Text, word, StringComparison.OrdinalIgnoreCase) >= 0);
TokeiLibrary.WPF.Extensions.ScrollToCenterOfView(_completionWindow.CompletionList.ListBox, _completionWindow.CompletionList.SelectedItem);
}
开发者ID:Tokeiburu,项目名称:RagnarokSDE,代码行数:40,代码来源:ScriptEditDialog.xaml.cs
示例19: 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 };
}
开发者ID:neiz,项目名称:Wish,代码行数:37,代码来源:WishModel.cs
示例20: CompletionSelection
private CompletionSelection(CompletionContext context, Action onComplete)
{
_context = context;
_onComplete = onComplete;
ResultSet results = _context.ResultProvider.GetResults(_context.Path.Str, _context.Line, _context.Column, this);
if (results == null)
throw new System.Exception();
_completionWindow = new CompletionWindow(_context.TextArea);
foreach (IResult cd in results.Results)
{
_completionWindow.CompletionList.CompletionData.Add(cd);
}
_completionWindow.StartOffset = _context.Offset;
_completionWindow.EndOffset = _completionWindow.StartOffset + _context.TriggerWord.Length;
if (_context.TriggerWord.Length > 0)
{
_completionWindow.CompletionList.SelectItem(_context.TriggerWord);
if(_completionWindow.CompletionList.SelectedItem == null) //nothing to display
{
_completionWindow = null;
_onComplete();
;return;
}
}
_completionWindow.Show();
_completionWindow.Closed += (o, args) =>
{
_completionWindow = null;
_onComplete();
};
}
开发者ID:JadeHub,项目名称:Jade,代码行数:36,代码来源:CodeCompletion.cs
注:本文中的ICSharpCode.AvalonEdit.CodeCompletion.CompletionWindow类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论