private static bool IsValidBraceCompletionContext(PythonTextBufferInfo buffer, SnapshotPoint openingPoint)
        {
            if (buffer == null)
            {
                return(false);
            }

            Debug.Assert(openingPoint.Position >= 0, "SnapshotPoint.Position should always be zero or positive.");
            if (openingPoint.Position < 0)
            {
                return(false);
            }

            // If we have a token here that is in any of these categories, we do
            // not want to complete.
            var category = buffer.GetTokenAtPoint(openingPoint)?.Category ?? TokenCategory.None;

            return(!(
                       category == TokenCategory.Comment ||
                       category == TokenCategory.LineComment ||
                       category == TokenCategory.DocComment ||
                       category == TokenCategory.StringLiteral ||
                       category == TokenCategory.IncompleteMultiLineStringLiteral
                       ));
        }