private static string GetPathThroughLastSlash(SyntaxToken stringLiteral, int position)
 {
     return(PathCompletionUtilities.GetPathThroughLastSlash(
                quotedPath: stringLiteral.ToString(),
                quotedPathStart: stringLiteral.SpanStart,
                position: position));
 }
 private static TextSpan GetTextChangeSpan(SyntaxToken stringLiteral, int position)
 {
     return(PathCompletionUtilities.GetTextChangeSpan(
                quotedPath: stringLiteral.ToString(),
                quotedPathStart: stringLiteral.SpanStart,
                position: position));
 }
Ejemplo n.º 3
0
        internal static TextSpan GetTextChangeSpan(string quotedPath, int quotedPathStart, int position)
        {
            // We want the text change to be from after the last slash to the end of the quoted
            // path. If there is no last slash, then we want it from right after the start quote
            // character.
            var positionInQuotedPath = position - quotedPathStart;

            // Where we want to start tracking is right after the slash (if we have one), or else
            // right after the string starts.
            var afterLastSlashIndex = PathCompletionUtilities.AfterLastSlashIndex(quotedPath, positionInQuotedPath);
            var afterFirstQuote     = 1;

            var startIndex = Math.Max(afterLastSlashIndex, afterFirstQuote);
            var endIndex   = quotedPath.Length;

            // If the string ends with a quote, the we do not want to consume that.
            if (EndsWithQuote(quotedPath))
            {
                endIndex--;
            }

            return(TextSpan.FromBounds(startIndex + quotedPathStart, endIndex + quotedPathStart));
        }
Ejemplo n.º 4
0
 internal override bool IsInsertionTrigger(SourceText text, int characterPosition, OptionSet options)
 {
     return(PathCompletionUtilities.IsTriggerCharacter(text, characterPosition));
 }
 private TextSpan GetTextChangeSpan(SyntaxToken stringLiteral, int position)
 {
     return(PathCompletionUtilities.GetTextChangeSpan(stringLiteral.ToString(), stringLiteral.SpanStart, position));
 }
 public override bool?SendEnterThroughToEditor(Microsoft.CodeAnalysis.Completion.CompletionItem completionItem, string textTypedSoFar, OptionSet options)
 {
     return(PathCompletionUtilities.SendEnterThroughToEditor(completionItem, textTypedSoFar));
 }
 public override bool?IsFilterCharacter(Microsoft.CodeAnalysis.Completion.CompletionItem completionItem, char ch, string textTypedSoFar)
 {
     return(PathCompletionUtilities.IsFilterCharacter(completionItem, ch, textTypedSoFar));
 }