// Internal for benchmarking and testing
        internal static CompletionList CreateLSPCompletionList(
            IReadOnlyList <RazorCompletionItem> razorCompletionItems,
            CompletionListCache completionListCache,
            IReadOnlyList <ExtendedCompletionItemKinds> supportedItemKinds)
        {
            var resultId        = completionListCache.Set(razorCompletionItems);
            var completionItems = new List <CompletionItem>();

            foreach (var razorCompletionItem in razorCompletionItems)
            {
                if (TryConvert(razorCompletionItem, supportedItemKinds, out var completionItem))
                {
                    // The completion items are cached and can be retrieved via this result id to enable the "resolve" completion functionality.
                    completionItem.SetCompletionListResultId(resultId);
                    completionItems.Add(completionItem);
                }
            }

            var completionList = new CompletionList(completionItems, isIncomplete: false);

            // We wrap the pre-existing completion list with an optimized completion list to better control serialization/deserialization
            var optimizedCompletionList = new OptimizedCompletionList(completionList);

            return(optimizedCompletionList);
        }
예제 #2
0
        // Internal for benchmarking
        internal static CompletionList CreateLSPCompletionList(IReadOnlyList <RazorCompletionItem> razorCompletionItems)
        {
            var completionItems = new List <CompletionItem>();

            foreach (var razorCompletionItem in razorCompletionItems)
            {
                if (TryConvert(razorCompletionItem, out var completionItem))
                {
                    completionItems.Add(completionItem);
                }
            }

            var completionList = new CompletionList(completionItems, isIncomplete: false);

            // We wrap the pre-existing completion list with an optimized completion list to better control serialization/deserialization
            var optimizedCompletionList = new OptimizedCompletionList(completionList);

            return(optimizedCompletionList);
        }