in Backend/Core/ForTea.Core/Services/TypingAssist/T4TypingAssist.cs [231:255]
private bool OnEnterPressed(IActionContext context)
{
var textControl = context.TextControl;
int charPos;
var lexer = GetCachingLexer(textControl);
if (lexer == null) return false;
if (!CheckAndDeleteSelectionIfNeeded(textControl,
selection =>
{
charPos = TextControlToLexer(textControl, selection.StartOffset.DocOffset());
if (charPos <= 0) return false;
if (!lexer.FindTokenAt(charPos - 1)) return false;
if (!IsBlockStart(lexer)) return false;
if (!lexer.FindTokenAt(charPos)) return false;
if (!IsBlockEnd(lexer)) return false;
return true;
})
) return false;
var offset = textControl.Caret.DocumentOffset();
var psiSourceFile = textControl.Document.GetPsiSourceFile(Solution);
// Only insert one newline, as another gets inserted automatically
textControl.Document.InsertText(offset, GetNewLineText(psiSourceFile));
textControl.Caret.MoveTo(offset, CaretVisualPlacement.DontScrollIfVisible);
return false;
}