public void Convert_DataTrue_RemovesDataFromItems()
        {
            // Arrange
            var dataObject = new JObject()
            {
                ["resultId"] = 123
            };
            var completionList = new CompletionList(
                new CompletionItem()
            {
                Label = "Test",
                Data  = dataObject,
            });
            var capabilities = new VSCompletionListCapability()
            {
                Data = true,
            };

            // Act
            var vsCompletionList = VSCompletionList.Convert(completionList, capabilities);

            // Assert
            Assert.Collection(vsCompletionList.Items, item => Assert.Null(item.Data));
            Assert.Same(dataObject, vsCompletionList.Data);
        }
        public void Convert_DataFalse_DoesNotTouchData()
        {
            // Arrange
            var dataObject = new JObject()
            {
                ["resultId"] = 123
            };
            var completionList = new CompletionList(
                new CompletionItem()
            {
                Label = "Test",
                Data  = dataObject,
            });
            var capabilities = new VSCompletionListCapability()
            {
                Data = false,
            };

            // Act
            var vsCompletionList = VSCompletionList.Convert(completionList, capabilities);

            // Assert
            Assert.Collection(vsCompletionList.Items, item => Assert.Same(dataObject, item.Data));
            Assert.Null(vsCompletionList.Data);
        }
        public static VSCompletionList Convert(CompletionList completionList, VSCompletionListCapability vsCompletionListCapability)
        {
            var vsCompletionList = new VSCompletionList(completionList);

            if (vsCompletionListCapability.CommitCharacters)
            {
                PromoteCommonCommitCharactersOntoList(vsCompletionList);
            }

            if (vsCompletionListCapability.Data)
            {
                PromotedDataOntoList(vsCompletionList);
            }

            return(vsCompletionList);
        }
        public void Convert_CommitCharactersFalse_DoesNotTouchCommitCharacters()
        {
            // Arrange
            var commitCharacters = new Container <string>("<");
            var completionList   = new CompletionList(
                new CompletionItem()
            {
                Label            = "Test",
                CommitCharacters = commitCharacters
            });
            var capabilities = new VSCompletionListCapability()
            {
                CommitCharacters = false,
            };

            // Act
            var vsCompletionList = VSCompletionList.Convert(completionList, capabilities);

            // Assert
            Assert.Collection(vsCompletionList.Items, item => Assert.Equal(commitCharacters, item.CommitCharacters));
            Assert.Null(vsCompletionList.CommitCharacters);
        }