Example #1
0
 private PartialParseResultInternal HandleInsertionAfterIdPart(SyntaxNode target, SourceChange change)
 {
     // If the insertion is a full identifier part, accept it
     if (ParserHelpers.IsIdentifier(change.NewText, requireIdentifierStart: false))
     {
         return(TryAcceptChange(target, change));
     }
     else if (IsDoubleParenthesisInsertion(change) || IsOpenParenthesisInsertion(change))
     {
         // Allow inserting parens after an identifier - this is needed to support signature
         // help intellisense in VS.
         return(TryAcceptChange(target, change));
     }
     else if (EndsWithDot(change.NewText))
     {
         // Accept it, possibly provisionally
         var result = PartialParseResultInternal.Accepted;
         if (!AcceptTrailingDot)
         {
             result |= PartialParseResultInternal.Provisional;
         }
         return(TryAcceptChange(target, change, result));
     }
     else
     {
         return(PartialParseResultInternal.Rejected);
     }
 }
 private PartialParseResult HandleInsertionAfterDot(Span target, TextChange change)
 {
     // If the insertion is a full identifier or another dot, accept it
     if (ParserHelpers.IsIdentifier(change.NewText) || change.NewText == ".")
     {
         return(TryAcceptChange(target, change));
     }
     return(PartialParseResult.Rejected);
 }
 // Completing 'DateTime' in intellisense with a '.' could result in: '@DateT' -> '@DateT.' -> '@DateTime.' which is accepted.
 private static bool IsNewDotlessCommitInsertion(Span target, TextChange change)
 {
     return(!IsAtEndOfSpan(target, change) &&
            change.NewPosition > 0 &&
            change.NewLength > 0 &&
            target.Content.Last() == '.' &&
            ParserHelpers.IsIdentifier(change.NewText, requireIdentifierStart: false) &&
            (change.OldLength == 0 || ParserHelpers.IsIdentifier(change.OldText, requireIdentifierStart: false)));
 }
Example #4
0
 // Completing 'DateTime' in intellisense with a '.' could result in: '@DateT' -> '@DateT.' -> '@DateTime.' which is accepted.
 private static bool IsNewDotlessCommitInsertion(SyntaxNode target, SourceChange change)
 {
     return(!IsAtEndOfSpan(target, change) &&
            change.Span.AbsoluteIndex > 0 &&
            change.NewText.Length > 0 &&
            target.GetContent().Last() == '.' &&
            ParserHelpers.IsIdentifier(change.NewText, requireIdentifierStart: false) &&
            (change.Span.Length == 0 || ParserHelpers.IsIdentifier(change.GetOriginalText(target), requireIdentifierStart: false)));
 }
Example #5
0
 private PartialParseResult HandleInsertionAfterDot(TextChange change)
 {
     // If the insertion is a full identifier, accept it
     if (ParserHelpers.IsIdentifier(change.NewText))
     {
         return(TryAcceptChange(change));
     }
     return(PartialParseResult.Rejected);
 }
 private PartialParseResult HandleInsertionAfterIdPart(Span target, TextChange change)
 {
     // If the insertion is a full identifier part, accept it
     if (ParserHelpers.IsIdentifier(change.NewText, requireIdentifierStart: false))
     {
         return(TryAcceptChange(target, change));
     }
     else if (EndsWithDot(change.NewText))
     {
         // Accept it, possibly provisionally
         PartialParseResult result = PartialParseResult.Accepted;
         if (!AcceptTrailingDot)
         {
             result |= PartialParseResult.Provisional;
         }
         return(TryAcceptChange(target, change, result));
     }
     else
     {
         return(PartialParseResult.Rejected);
     }
 }