private void CreateAutoBlockCompleter(PartialParseResult parseResult, TextChange textChange) { if (IsFlagSet(parseResult, PartialParseResult.AutoCompleteBlock)) { _autoBlockCompletor = new AutoBlockCompletor(TextView, textChange.NewPosition, _razorEditorParser.GetAutoCompleteString()); return; } if (textChange.OldLength == 0 && textChange.NewLength > 0 && textChange.NewLength <= 2 && Whitespace.IsNewLine((textChange.NewBuffer as IShimTextBuffer).Snapshot.GetText(textChange.NewPosition, textChange.NewLength)) && _viewBuffer.ContentType.IsOfType("RazorCSharp")) { ITextSnapshot currentSnapshot = _viewBuffer.CurrentSnapshot; ITextSnapshotLine lineFromPosition = currentSnapshot.GetLineFromPosition(textChange.NewPosition); string text = lineFromPosition.GetText(); int num = Math.Min(lineFromPosition.Length, textChange.NewPosition - lineFromPosition.Start) - 1; while (num >= 0 && char.IsWhiteSpace(text[num])) { num--; } if (num >= 1 && text[num] == '{' && text[num - 1] == '@') { int num2 = textChange.NewPosition + textChange.NewLength; ITextSnapshotLine lineFromPosition2 = currentSnapshot.GetLineFromPosition(num2); string text2 = lineFromPosition2.GetText(); int num3 = num2 - lineFromPosition2.Start; while (num3 < lineFromPosition2.Length && char.IsWhiteSpace(text2[num3])) { num3++; } if (num3 < lineFromPosition2.Length && text2[num3] == '}') { _autoBlockCompletor = new AutoBlockCompletor(TextView, textChange.NewPosition, string.Empty); } } } }
private void TextBuffer_OnPostChanged(object sender, EventArgs e) { if (_autoBlockCompletor != null) { AutoBlockCompletor arg_15_0 = _autoBlockCompletor; _autoBlockCompletor = null; arg_15_0.CompleteBlock(); } }