private void OnPresenterSessionItemSelected(object sender, CompletionItemEventArgs e) { AssertIsForeground(); Contract.ThrowIfFalse(ReferenceEquals(this.PresenterSession, sender)); SetModelSelectedItem(m => e.CompletionItem); }
private void OnPresenterSessionItemCommitted(object sender, CompletionItemEventArgs e) { AssertIsForeground(); Contract.ThrowIfFalse(ReferenceEquals(this.PresenterSession, sender)); this.Controller.CommitItem(e.CompletionItem); }
private void CompletionSession_ItemCommitted(object sender, CompletionItemEventArgs itemEventArgs) { if (TryIsChooseMethod(itemEventArgs)) { EditorOperations = _editorOperationsFactory.GetEditorOperations(TextView); string parenthesis = "()"; EditorOperations.InsertText(parenthesis); } }
private bool TryIsChooseMethod(CompletionItemEventArgs itemEventArgs) { if (itemEventArgs.Item.Filters.IsEmpty) { return(false); } var allowedMethods = new Dictionary <string, string>() { { "m", "Methods" }, { "x", "Extension methods" } }; foreach (var item in itemEventArgs.Item.Filters) { if (allowedMethods.ContainsKey(item.AccessKey) && allowedMethods[item.AccessKey] == item.DisplayText) { return(true); } } return(false); }