protected override bool ShouldStartSessionOnTyping(IWpfTextView textView, char ch) { if (char.IsWhiteSpace(ch)) { return(false); } if (ch == '|' || ch == '#' || ch == '*' || ch == '@') //TODO: get this from parser? { return(false); } var caretBufferPosition = textView.Caret.Position.BufferPosition; var line = caretBufferPosition.GetContainingLine(); if (caretBufferPosition == line.Start) { return(false); // we are at the beginning of a line (after an enter?) } var linePrefixText = new SnapshotSpan(line.Start, caretBufferPosition.Subtract(1)).GetText(); return(linePrefixText.All(char.IsWhiteSpace)); // start auto completion for the first typed in character in the line }