internal static CompletionResults Create(
     ScriptFile scriptFile,
     CommandCompletion commandCompletion)
 {
     return new CompletionResults
     {
         Completions = GetCompletionsArray(commandCompletion),
         ReplacedRange = 
             scriptFile.GetRangeBetweenOffsets(
                 commandCompletion.ReplacementIndex,
                 commandCompletion.ReplacementIndex + commandCompletion.ReplacementLength)
     };
 }
Example #2
0
 internal static CompletionResults Create(
     ScriptFile scriptFile,
     CommandCompletion commandCompletion)
 {
     return(new CompletionResults
     {
         Completions = GetCompletionsArray(commandCompletion),
         ReplacedRange =
             scriptFile.GetRangeBetweenOffsets(
                 commandCompletion.ReplacementIndex,
                 commandCompletion.ReplacementIndex + commandCompletion.ReplacementLength)
     });
 }
Example #3
0
        internal static CompletionResults Create(
            ScriptFile scriptFile,
            CommandCompletion commandCompletion)
        {
            BufferRange replacedRange = null;

            // Only calculate the replacement range if there are completion results
            if (commandCompletion.CompletionMatches.Count > 0)
            {
                replacedRange =
                    scriptFile.GetRangeBetweenOffsets(
                        commandCompletion.ReplacementIndex,
                        commandCompletion.ReplacementIndex + commandCompletion.ReplacementLength);
            }

            return(new CompletionResults
            {
                Completions = GetCompletionsArray(commandCompletion),
                ReplacedRange = replacedRange
            });
        }