public override int GetHashCode() { int hash = 1; if (ResourceName.Length != 0) { hash ^= ResourceName.GetHashCode(); } if (HasAdGroupCriterion) { hash ^= AdGroupCriterion.GetHashCode(); } if (HasParameterIndex) { hash ^= ParameterIndex.GetHashCode(); } if (HasInsertionText) { hash ^= InsertionText.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <inheritdoc /> public void Commit() { if (!session.SelectedCompletionSet.SelectionStatus.IsSelected) { return; } ITrackingSpan applicableTo = session.SelectedCompletionSet.ApplicableTo; using (ITextEdit edit = applicableTo.TextBuffer.CreateEdit()) { // The insertion text is inserted without the \xFF character (if any) string insertionText = InsertionText.Replace("\xFF", ""); edit.Replace(applicableTo.GetSpan(edit.Snapshot), insertionText); ITextSnapshot applied = edit.Apply(); // The original position of the \xFF character determines the placement of the caret int caretOffset = InsertionText.IndexOf('\xFF'); if (caretOffset >= 0) { SnapshotPoint startPoint = applicableTo.GetStartPoint(applied); SnapshotPoint caretPoint = startPoint + caretOffset; session.TextView.Caret.MoveTo(caretPoint, PositionAffinity.Predecessor); } } }