PaketCompletionContext CreatePaketCompletionContext(
     CodeCompletionContext completionContext,
     PaketDependencyFileLineParseResult result,
     PaketCompletionType completionType)
 {
     return(new PaketCompletionContext {
         CompletionType = completionType,
         Keyword = result.RuleName
     });
 }
        PaketCompletionContext GetCompletionContext(CodeCompletionContext completionContext, int triggerWordLength)
        {
            PaketDependencyFileLineParseResult result = ParseLine(completionContext);

            if (result == null)
            {
                return(PaketCompletionContext.None);
            }

            if (result.IsComment)
            {
                return(PaketCompletionContext.None);
            }

            if (result.IsCurrentItemFirstKeywordValue)
            {
                if (result.IsSourceRule())
                {
                    return(new PaketCompletionContext {
                        CompletionType = PaketCompletionType.NuGetPackageSource
                    });
                }
                else if (result.IsNuGetRule())
                {
                    return(new PaketCompletionContext {
                        CompletionType = PaketCompletionType.NuGetPackage
                    });
                }
                else
                {
                    var paketContext = CreatePaketCompletionContext(completionContext, result, PaketCompletionType.KeywordValue);
                    if (result.TotalItems < result.CurrentItem)
                    {
                        paketContext.TriggerWordLength = 0;
                    }
                    else
                    {
                        paketContext.TriggerWordLength = triggerWordLength;
                    }
                    return(paketContext);
                }
            }
            else if (result.CurrentItem > 1)
            {
                return(PaketCompletionContext.None);
            }

            return(CreatePaketCompletionContext(completionContext, result, PaketCompletionType.Keyword));
        }