private void UpdateVisibility() { Dictionary <int, List <Completion> > matches = new Dictionary <int, List <Completion> >(); int maxKey = 0; string typedText = GetTypedText(); if (typedText.Length == 0) { return; } foreach (RCompletion c in _completions) { int key = Match(typedText, c.DisplayText); if (key > 0) { List <Completion> list; if (!matches.TryGetValue(key, out list)) { list = new List <Completion>(); matches[key] = list; maxKey = Math.Max(maxKey, key); } list.Add(c); } } if (maxKey > 0) { _completions.ForEach(x => ((RCompletion)x).IsVisible = false); matches[maxKey].ForEach(x => ((RCompletion)x).IsVisible = true); } }
public void Show(TextArea textArea, List <SymbolData> symbols) { CompletionWindow = new CompletionWindow(textArea); IList <ICompletionData> data = CompletionWindow.CompletionList.CompletionData; CompletionList.ForEach(cd => data.Add(cd)); CompletionWindow.Closed += delegate { CompletionWindow = null; }; symbols.ForEach(s => data.Add(new CompletionData(s.SymbolName) { DescriptionText = s.SymbolText, InstructionType = InstructionType.Basic })); CompletionWindow.Show(); }