private void VerifyTriggerCharactersWorker(char[] expectedTriggerCharacters, char[] unexpectedTriggerCharacters, SourceCodeKind sourceCodeKind)
        {
            ISignatureHelpProvider signatureHelpProvider = CreateSignatureHelpProvider();

            foreach (var expectedTriggerCharacter in expectedTriggerCharacters)
            {
                Assert.True(signatureHelpProvider.IsTriggerCharacter(expectedTriggerCharacter), "Expected '" + expectedTriggerCharacter + "' to be a trigger character");
            }

            foreach (var unexpectedTriggerCharacter in unexpectedTriggerCharacters)
            {
                Assert.False(signatureHelpProvider.IsTriggerCharacter(unexpectedTriggerCharacter), "Expected '" + unexpectedTriggerCharacter + "' to NOT be a trigger character");
            }
        }
Example #2
0
        public static async Task <bool> IsTriggerCharacter([NotNull] this ISignatureHelpProvider provider, Document document, int position)
        {
            if (provider == null)
            {
                throw new ArgumentNullException(nameof(provider));
            }
            var text = await document.GetTextAsync().ConfigureAwait(false);

            var character = text.GetSubText(new TextSpan(position, 1))[0];

            return(provider.IsTriggerCharacter(character));
        }