private static CompletionItemRules MakeRule(bool importDirective, bool preselect, bool tupleLiteral)
        {
            // '<' should not filter the completion list, even though it's in generic items like IList<>
            var generalBaseline = CompletionItemRules.Default.
                                  WithFilterCharacterRule(CharacterSetModificationRule.Create(CharacterSetModificationKind.Remove, '<')).
                                  WithCommitCharacterRule(CharacterSetModificationRule.Create(CharacterSetModificationKind.Add, '<'));

            var importDirectiveBaseline = CompletionItemRules.Create(commitCharacterRules:
                                                                     ImmutableArray.Create(CharacterSetModificationRule.Create(CharacterSetModificationKind.Replace, '.', ';')));

            var rule = importDirective ? importDirectiveBaseline : generalBaseline;

            if (preselect)
            {
                rule = rule.WithSelectionBehavior(CompletionItemSelectionBehavior.HardSelection);
            }

            if (tupleLiteral)
            {
                rule = rule
                       .WithCommitCharacterRule(CharacterSetModificationRule.Create(CharacterSetModificationKind.Remove, ':'));
            }

            return(rule);
        }
        const string InsertionTextKey = "InsertionText/914D9212-A782-45C9-970F-405B732E10B5";         // hopefully unique id

        public CompletionItem CreateCompletionItem(string insertionText, string descriptionText, string[] tags) =>
        CompletionItem.Create(descriptionText,
                              properties: ImmutableDictionary <string, string> .Empty.Add(InsertionTextKey, insertionText), // add custom insertion text property to be used in GetChangeAsync
                              tags: ImmutableArray.Create(tags),
                              rules: CompletionItemRules.Create(
                                  // allow usage of open paren while writing the identifier
                                  filterCharacterRules: ImmutableArray <CharacterSetModificationRule> .Empty.Add(CharacterSetModificationRule.Create(CharacterSetModificationKind.Add, '(')),
                                  commitCharacterRules: ImmutableArray <CharacterSetModificationRule> .Empty.Add(CharacterSetModificationRule.Create(CharacterSetModificationKind.Remove, '('))
                                  ));