private void OnKeyDown(object sender, KeyEventArgs e) { if (e.Handled) { return; } if (this.completionBroker != null) { CodeAidContext codeAidContext = this.CreateCodeAidContext(); CodeAidAction action = this.codeAidEngine.ProcessKeyDown(e.Key, codeAidContext); if (!action.IsNone) { this.ExecuteCodeAidAction(action, false); } if (action.TestFlag(CodeAidActionType.EatInput)) { e.Handled = true; } else { this.OnKeyDownHelper(e); } this.ExecuteFormattingAction(action); } else { this.OnKeyDownHelper(e); } }
private bool CreateAndExecuteCodeAidAction(TextCompositionEventArgs e, bool matchingModeOnly) { PerformanceUtility.MeasurePerformanceUntilRender(PerformanceEvent.TextInsertLetter); if (this.completionBroker == null) { return(false); } CodeAidContext codeAidContext = this.CreateCodeAidContext(); CodeAidAction action = this.codeAidEngine.ProcessTextInput(e.Text, codeAidContext); if (!action.IsNone) { this.ExecuteCodeAidAction(action, matchingModeOnly); } if (!action.TestFlag(CodeAidActionType.EatInput) && !matchingModeOnly) { this.editorOperations.InsertText(e.Text, this.undoHistory); } return(true); }