public virtual bool AllowOverType(IBraceCompletionSession session) { SnapshotPoint?caretPosition = session.GetCaretPosition(); if (!caretPosition.HasValue || !this.LanguageInfo.IsValidContext(caretPosition.Value)) { return(false); } this.LanguageInfo.DismissAllAndCommitActiveOne(session.TextView, session.ClosingBrace); return(true); }
protected bool CheckCurrentPosition(IBraceCompletionSession session, CancellationToken cancellationToken) { var document = session.SubjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); if (document != null) { // make sure auto closing is called from a valid position var tree = document.GetSyntaxRootSynchronously(cancellationToken).SyntaxTree; return !_syntaxFactsService.IsInNonUserCode(tree, session.GetCaretPosition().Value, cancellationToken); } return true; }
protected bool CheckCurrentPosition(IBraceCompletionSession session, CancellationToken cancellationToken) { var document = session.SubjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); if (document != null) { // make sure auto closing is called from a valid position var tree = document.GetSyntaxRootSynchronously(cancellationToken).SyntaxTree; return(!_syntaxFactsService.IsInNonUserCode(tree, session.GetCaretPosition().Value, cancellationToken)); } return(true); }