diff --git a/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller.Session_ComputeModel.cs b/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller.Session_ComputeModel.cs index 0e9ee681bed48..370724add4ba4 100644 --- a/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller.Session_ComputeModel.cs +++ b/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller.Session_ComputeModel.cs @@ -75,7 +75,7 @@ private async Task ComputeModelInBackgroundAsync( } if (triggerInfo.TriggerCharacter.HasValue && - !currentModel.Provider.IsRetriggerCharacter(triggerInfo.TriggerCharacter.Value)) + !currentModel.Provider.RetriggerCharacters.Contains(triggerInfo.TriggerCharacter.Value)) { return currentModel; } diff --git a/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller_TypeChar.cs b/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller_TypeChar.cs index 0248261a75982..56b1264e7e4d0 100644 --- a/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller_TypeChar.cs +++ b/src/EditorFeatures/Core.Wpf/SignatureHelp/Controller_TypeChar.cs @@ -100,7 +100,7 @@ void IChainedCommandHandler.ExecuteCommand(TypeCharCommandA else { var computed = false; - if (allProviders.Any(static (p, args) => p.IsRetriggerCharacter(args.TypedChar), args)) + if (allProviders.Any(static (p, args) => p.RetriggerCharacters.Contains(args.TypedChar), args)) { // The user typed a character that might close the scope of the current model. // In this case, we should requery all providers. @@ -138,7 +138,7 @@ void IChainedCommandHandler.ExecuteCommand(TypeCharCommandA using var unmatchedProvidersDisposer = ArrayBuilder.GetInstance(out var unmatchedProviders); foreach (var provider in providers) { - if (provider.IsTriggerCharacter(ch)) + if (provider.TriggerCharacters.Contains(ch)) { matchedProviders.Add(provider); } diff --git a/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb b/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb index 66d9c617a1253..6314ace2ba66b 100644 --- a/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb +++ b/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Runtime.CompilerServices Imports System.Threading Imports Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense @@ -60,8 +61,8 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense ' Create a provider that will return an empty state when queried the second time Dim slowProvider = New Mock(Of ISignatureHelpProvider)(MockBehavior.Strict) - slowProvider.Setup(Function(p) p.IsTriggerCharacter(" "c)).Returns(True) - slowProvider.Setup(Function(p) p.IsRetriggerCharacter(" "c)).Returns(True) + slowProvider.Setup(Function(p) p.TriggerCharacters).Returns(ImmutableArray.Create(Of Char)(" "c)) + slowProvider.Setup(Function(p) p.RetriggerCharacters).Returns(ImmutableArray.Create(Of Char)(" "c)) slowProvider.Setup(Function(p) p.GetItemsAsync(It.IsAny(Of Document), It.IsAny(Of Integer), It.IsAny(Of SignatureHelpTriggerInfo), options, It.IsAny(Of CancellationToken))) _ .Returns(Task.FromResult(New SignatureHelpItems(CreateItems(2), TextSpan.FromBounds(0, 0), selectedItem:=0, semanticParameterIndex:=0, syntacticArgumentCount:=0, argumentName:=Nothing))) Dim controller = Await CreateController(CreateWorkspace(), provider:=slowProvider.Object, waitForPresentation:=True) @@ -214,13 +215,17 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense Nothing)) End Function - Public Function IsTriggerCharacter(ch As Char) As Boolean Implements ISignatureHelpProvider.IsTriggerCharacter - Return ch = "("c - End Function - - Public Function IsRetriggerCharacter(ch As Char) As Boolean Implements ISignatureHelpProvider.IsRetriggerCharacter - Return ch = ")"c - End Function + Public ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) Implements ISignatureHelpProvider.TriggerCharacters + Get + Return ImmutableArray.Create("("c) + End Get + End Property + + Public ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) Implements ISignatureHelpProvider.RetriggerCharacters + Get + Return ImmutableArray.Create(")"c) + End Get + End Property End Class Private Shared Function CreateMockTextView(buffer As ITextBuffer) As Mock(Of ITextView) diff --git a/src/EditorFeatures/TestUtilities/SignatureHelp/AbstractSignatureHelpProviderTests.cs b/src/EditorFeatures/TestUtilities/SignatureHelp/AbstractSignatureHelpProviderTests.cs index 56c499ba2c081..5bf6810b8e009 100644 --- a/src/EditorFeatures/TestUtilities/SignatureHelp/AbstractSignatureHelpProviderTests.cs +++ b/src/EditorFeatures/TestUtilities/SignatureHelp/AbstractSignatureHelpProviderTests.cs @@ -131,12 +131,12 @@ protected void VerifyTriggerCharacters(char[] expectedTriggerCharacters, char[] foreach (var expectedTriggerCharacter in expectedTriggerCharacters) { - Assert.True(signatureHelpProvider.IsTriggerCharacter(expectedTriggerCharacter), "Expected '" + expectedTriggerCharacter + "' to be a trigger character"); + Assert.True(signatureHelpProvider.TriggerCharacters.Contains(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"); + Assert.False(signatureHelpProvider.TriggerCharacters.Contains(unexpectedTriggerCharacter), "Expected '" + unexpectedTriggerCharacter + "' to NOT be a trigger character"); } } @@ -389,7 +389,7 @@ private async Task TestSignatureHelpWorkerSharedAsync( SignatureHelpTriggerReason.TypeCharCommand, code.ElementAt(cursorPosition - 1)); - if (!signatureHelpProvider.IsTriggerCharacter(triggerInfo.TriggerCharacter.Value)) + if (!signatureHelpProvider.TriggerCharacters.Contains(triggerInfo.TriggerCharacter.Value)) { return; } diff --git a/src/Features/CSharp/Portable/SignatureHelp/AttributeSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/AttributeSignatureHelpProvider.cs index e0b7d7707f28b..5272de00c2373 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/AttributeSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/AttributeSignatureHelpProvider.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Composition; using System.Diagnostics.CodeAnalysis; using System.Linq; @@ -31,11 +32,9 @@ public AttributeSignatureHelpProvider() { } - public override bool IsTriggerCharacter(char ch) - => ch is '(' or ','; + public override ImmutableArray TriggerCharacters => ['(', ',']; - public override bool IsRetriggerCharacter(char ch) - => ch == ')'; + public override ImmutableArray RetriggerCharacters => [')']; private bool TryGetAttributeExpression( SyntaxNode root, @@ -58,7 +57,7 @@ private bool IsTriggerToken(SyntaxToken token) { return !token.IsKind(SyntaxKind.None) && token.ValueText.Length == 1 && - IsTriggerCharacter(token.ValueText[0]) && + TriggerCharacters.Contains(token.ValueText[0]) && token.Parent is AttributeArgumentListSyntax && token.Parent.Parent is AttributeSyntax; } diff --git a/src/Features/CSharp/Portable/SignatureHelp/ConstructorInitializerSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/ConstructorInitializerSignatureHelpProvider.cs index aead0e4d63f1a..9e87eba563fbb 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/ConstructorInitializerSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/ConstructorInitializerSignatureHelpProvider.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Composition; using System.Linq; using System.Threading; @@ -29,11 +30,9 @@ public ConstructorInitializerSignatureHelpProvider() { } - public override bool IsTriggerCharacter(char ch) - => ch is '(' or ','; + public override ImmutableArray TriggerCharacters => ['(', ',']; - public override bool IsRetriggerCharacter(char ch) - => ch == ')'; + public override ImmutableArray RetriggerCharacters => [')']; private async Task TryGetConstructorInitializerAsync( Document document, @@ -57,7 +56,7 @@ public override bool IsRetriggerCharacter(char ch) } private bool IsTriggerToken(SyntaxToken token) - => SignatureHelpUtilities.IsTriggerParenOrComma(token, IsTriggerCharacter); + => SignatureHelpUtilities.IsTriggerParenOrComma(token, TriggerCharacters); private static bool IsArgumentListToken(ConstructorInitializerSyntax expression, SyntaxToken token) { diff --git a/src/Features/CSharp/Portable/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs index 326004f333195..715fa44cd3cd1 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs @@ -28,20 +28,17 @@ namespace Microsoft.CodeAnalysis.CSharp.SignatureHelp; [ExportSignatureHelpProvider("ElementAccessExpressionSignatureHelpProvider", LanguageNames.CSharp), Shared] internal sealed class ElementAccessExpressionSignatureHelpProvider : AbstractCSharpSignatureHelpProvider { + private static readonly ImmutableArray s_triggerCharacters = ['[', ',']; + [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public ElementAccessExpressionSignatureHelpProvider() { } - public override bool IsTriggerCharacter(char ch) - => IsTriggerCharacterInternal(ch); - - private static bool IsTriggerCharacterInternal(char ch) - => ch is '[' or ','; + public override ImmutableArray TriggerCharacters => s_triggerCharacters; - public override bool IsRetriggerCharacter(char ch) - => ch == ']'; + public override ImmutableArray RetriggerCharacters => [']']; private static bool TryGetElementAccessExpression(SyntaxNode root, int position, ISyntaxFactsService syntaxFacts, SignatureHelpTriggerReason triggerReason, CancellationToken cancellationToken, [NotNullWhen(true)] out ExpressionSyntax? identifier, out SyntaxToken openBrace) { @@ -281,7 +278,7 @@ internal static bool IsTriggerToken(SyntaxToken token) { return !token.IsKind(SyntaxKind.None) && token.ValueText.Length == 1 && - IsTriggerCharacterInternal(token.ValueText[0]) && + s_triggerCharacters.Contains(token.ValueText[0]) && token.Parent is BracketedArgumentListSyntax && token.Parent.Parent is ElementAccessExpressionSyntax; } @@ -330,7 +327,7 @@ internal static bool IsTriggerToken(SyntaxToken token) { return !token.IsKind(SyntaxKind.None) && token.ValueText.Length == 1 && - IsTriggerCharacterInternal(token.ValueText[0]) && + s_triggerCharacters.Contains(token.ValueText[0]) && token.Parent is ArrayRankSpecifierSyntax; } @@ -365,7 +362,7 @@ internal static bool IsTriggerToken(SyntaxToken token) { return !token.IsKind(SyntaxKind.None) && token.ValueText.Length == 1 && - IsTriggerCharacterInternal(token.ValueText[0]) && + s_triggerCharacters.Contains(token.ValueText[0]) && token.Parent is BracketedArgumentListSyntax && token.Parent.Parent is ElementBindingExpressionSyntax && token.Parent.Parent.Parent is ConditionalAccessExpressionSyntax; diff --git a/src/Features/CSharp/Portable/SignatureHelp/GenericNameSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/GenericNameSignatureHelpProvider.cs index 29f039bca9177..2cc7b84a13b93 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/GenericNameSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/GenericNameSignatureHelpProvider.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Composition; using System.Linq; using System.Threading; @@ -31,11 +32,9 @@ public GenericNameSignatureHelpProvider() { } - public override bool IsTriggerCharacter(char ch) - => ch is '<' or ','; + public override ImmutableArray TriggerCharacters => ['<', ',']; - public override bool IsRetriggerCharacter(char ch) - => ch == '>'; + public override ImmutableArray RetriggerCharacters => ['>']; protected virtual bool TryGetGenericIdentifier( SyntaxNode root, int position, @@ -62,7 +61,7 @@ private bool IsTriggerToken(SyntaxToken token) { return !token.IsKind(SyntaxKind.None) && token.ValueText.Length == 1 && - IsTriggerCharacter(token.ValueText[0]) && + TriggerCharacters.Contains(token.ValueText[0]) && token.Parent is TypeArgumentListSyntax && token.Parent.Parent is GenericNameSyntax; } diff --git a/src/Features/CSharp/Portable/SignatureHelp/InitializerExpressionSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/InitializerExpressionSignatureHelpProvider.cs index 37642c9249a16..48379d5eba9be 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/InitializerExpressionSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/InitializerExpressionSignatureHelpProvider.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections.Immutable; using System.Composition; using System.Diagnostics.CodeAnalysis; using System.Linq; @@ -26,11 +27,9 @@ public InitializerExpressionSignatureHelpProvider() { } - public override bool IsTriggerCharacter(char ch) - => ch is '{' or ','; + public override ImmutableArray TriggerCharacters => ['{', ',']; - public override bool IsRetriggerCharacter(char ch) - => ch == '}'; + public override ImmutableArray RetriggerCharacters => ['}']; private bool TryGetInitializerExpression( SyntaxNode root, @@ -47,7 +46,7 @@ private bool TryGetInitializerExpression( private bool IsTriggerToken(SyntaxToken token) => !token.IsKind(SyntaxKind.None) && token.ValueText.Length == 1 && - IsTriggerCharacter(token.ValueText[0]) && + TriggerCharacters.Contains(token.ValueText[0]) && token.Parent is InitializerExpressionSyntax; private static bool IsInitializerExpressionToken(InitializerExpressionSyntax expression, SyntaxToken token) diff --git a/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.cs index d2313fa99f18e..d2395d49221a1 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.cs @@ -30,11 +30,9 @@ public InvocationExpressionSignatureHelpProvider() internal partial class InvocationExpressionSignatureHelpProviderBase : AbstractOrdinaryMethodSignatureHelpProvider { - public override bool IsTriggerCharacter(char ch) - => ch is '(' or ','; + public override ImmutableArray TriggerCharacters => ['(', ',']; - public override bool IsRetriggerCharacter(char ch) - => ch == ')'; + public override ImmutableArray RetriggerCharacters => [')']; private async Task TryGetInvocationExpressionAsync(Document document, int position, SignatureHelpTriggerReason triggerReason, CancellationToken cancellationToken) { @@ -54,7 +52,7 @@ public override bool IsRetriggerCharacter(char ch) } private bool IsTriggerToken(SyntaxToken token) - => SignatureHelpUtilities.IsTriggerParenOrComma(token, IsTriggerCharacter); + => SignatureHelpUtilities.IsTriggerParenOrComma(token, TriggerCharacters); private static bool IsArgumentListToken(InvocationExpressionSyntax expression, SyntaxToken token) { diff --git a/src/Features/CSharp/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.cs index 9b4b2a6aaea8c..e1cb1f0c44f86 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections.Immutable; using System.Composition; using System.Diagnostics; using System.Threading; @@ -22,11 +23,9 @@ namespace Microsoft.CodeAnalysis.CSharp.SignatureHelp; [method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] internal sealed partial class ObjectCreationExpressionSignatureHelpProvider() : AbstractCSharpSignatureHelpProvider { - public override bool IsTriggerCharacter(char ch) - => ch is '(' or ','; + public override ImmutableArray TriggerCharacters => ['(', ',']; - public override bool IsRetriggerCharacter(char ch) - => ch == ')'; + public override ImmutableArray RetriggerCharacters => [')']; private async Task TryGetObjectCreationExpressionAsync( Document document, @@ -50,7 +49,7 @@ public override bool IsRetriggerCharacter(char ch) } private bool IsTriggerToken(SyntaxToken token) - => SignatureHelpUtilities.IsTriggerParenOrComma(token, IsTriggerCharacter); + => SignatureHelpUtilities.IsTriggerParenOrComma(token, TriggerCharacters); private static bool IsArgumentListToken(BaseObjectCreationExpressionSyntax expression, SyntaxToken token) { diff --git a/src/Features/CSharp/Portable/SignatureHelp/PrimaryConstructorBaseTypeSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/PrimaryConstructorBaseTypeSignatureHelpProvider.cs index 1d8bd6160776b..b3c345f2d0a2e 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/PrimaryConstructorBaseTypeSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/PrimaryConstructorBaseTypeSignatureHelpProvider.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Composition; using System.Diagnostics.CodeAnalysis; using System.Linq; @@ -35,11 +36,9 @@ public PrimaryConstructorBaseTypeSignatureHelpProvider() { } - public override bool IsTriggerCharacter(char ch) - => ch is '(' or ','; + public override ImmutableArray TriggerCharacters => ['(', ',']; - public override bool IsRetriggerCharacter(char ch) - => ch == ')'; + public override ImmutableArray RetriggerCharacters => [')']; private bool TryGetBaseTypeSyntax( SyntaxNode root, @@ -65,7 +64,7 @@ static bool IsArgumentListToken(PrimaryConstructorBaseTypeSyntax expression, Syn } private bool IsTriggerToken(SyntaxToken token) - => SignatureHelpUtilities.IsTriggerParenOrComma(token, IsTriggerCharacter); + => SignatureHelpUtilities.IsTriggerParenOrComma(token, TriggerCharacters); protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) { diff --git a/src/Features/CSharp/Portable/SignatureHelp/SignatureHelpUtilities.cs b/src/Features/CSharp/Portable/SignatureHelp/SignatureHelpUtilities.cs index a71ae5cf6db5a..dfaf0f5d31b9d 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/SignatureHelpUtilities.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/SignatureHelpUtilities.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.SignatureHelp; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Shared.Extensions; +using System.Collections.Immutable; namespace Microsoft.CodeAnalysis.CSharp.SignatureHelp; @@ -96,7 +97,7 @@ internal static TextSpan GetSignatureHelpSpan(InitializerExpressionSyntax initia internal static TextSpan GetSignatureHelpSpan(AttributeArgumentListSyntax argumentList) => CommonSignatureHelpUtilities.GetSignatureHelpSpan(argumentList, s_getAttributeArgumentListCloseToken); - internal static bool IsTriggerParenOrComma(SyntaxToken token, Func isTriggerCharacter) where TSyntaxNode : SyntaxNode + internal static bool IsTriggerParenOrComma(SyntaxToken token, ImmutableArray triggerCharacters) where TSyntaxNode : SyntaxNode { // Don't dismiss if the user types ( to start a parenthesized expression or tuple // Note that the tuple initially parses as a parenthesized expression @@ -134,7 +135,7 @@ internal static bool IsTriggerParenOrComma(SyntaxToken token, Func< return !token.IsKind(SyntaxKind.None) && token.ValueText.Length == 1 && - isTriggerCharacter(token.ValueText[0]) && + triggerCharacters.Contains(token.ValueText[0]) && token.Parent is ArgumentListSyntax && token.Parent.Parent is TSyntaxNode; } diff --git a/src/Features/CSharp/Portable/SignatureHelp/TupleConstructionSignatureHelpProvider.cs b/src/Features/CSharp/Portable/SignatureHelp/TupleConstructionSignatureHelpProvider.cs index b664defa6e8ed..c1cfc778abde8 100644 --- a/src/Features/CSharp/Portable/SignatureHelp/TupleConstructionSignatureHelpProvider.cs +++ b/src/Features/CSharp/Portable/SignatureHelp/TupleConstructionSignatureHelpProvider.cs @@ -98,11 +98,9 @@ private bool GetOuterMostParenthesizedExpressionInSpan(SyntaxNode root, int posi return result != null; } - public override Boolean IsRetriggerCharacter(Char ch) - => ch == ')'; + public override ImmutableArray TriggerCharacters => ['(', ',']; - public override Boolean IsTriggerCharacter(Char ch) - => ch is '(' or ','; + public override ImmutableArray RetriggerCharacters => [')']; protected override async Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) { @@ -207,7 +205,7 @@ private bool TryGetTupleExpression(SignatureHelpTriggerReason triggerReason, Syn } private bool IsTupleExpressionTriggerToken(SyntaxToken token) - => SignatureHelpUtilities.IsTriggerParenOrComma(token, IsTriggerCharacter); + => SignatureHelpUtilities.IsTriggerParenOrComma(token, TriggerCharacters); private static bool IsTupleArgumentListToken(TupleExpressionSyntax? tupleExpression, SyntaxToken token) { diff --git a/src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/VSTypeScriptSignatureHelpProviderBase.cs b/src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/VSTypeScriptSignatureHelpProviderBase.cs index d0466a9cbb719..1a7d17930f2da 100644 --- a/src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/VSTypeScriptSignatureHelpProviderBase.cs +++ b/src/Features/Core/Portable/ExternalAccess/VSTypeScript/Api/VSTypeScriptSignatureHelpProviderBase.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; +using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.SignatureHelp; @@ -14,11 +16,50 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api; /// internal abstract class VSTypeScriptSignatureHelpProviderBase : ISignatureHelpProvider { + public ImmutableArray TriggerCharacters + { + get + { + if (TypeScriptTriggerCharacters.IsEmpty) + { + // Hard coded from https://devdiv.visualstudio.com/DevDiv/_git/TypeScript-VS?path=/VS/LanguageService/TypeScriptLanguageService/Features/SignatureHelp/TypeScriptSignatureHelpProvider.cs&version=GBmain&line=29&lineEnd=30&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents + return ['<', '(', ',']; + } + else + { + return TypeScriptTriggerCharacters; + } + } + } + + public ImmutableArray RetriggerCharacters + { + get + { + if (TypeScriptRetriggerCharacters.IsEmpty) + { + // Hard coded from https://devdiv.visualstudio.com/DevDiv/_git/TypeScript-VS?path=/VS/LanguageService/TypeScriptLanguageService/Features/SignatureHelp/TypeScriptSignatureHelpProvider.cs&version=GBmain&line=29&lineEnd=30&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents + return ['>', ')']; + } + else + { + return TypeScriptRetriggerCharacters; + } + } + } + Task ISignatureHelpProvider.GetItemsAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) => GetItemsAsync(document, position, triggerInfo, cancellationToken); - public abstract bool IsTriggerCharacter(char ch); - public abstract bool IsRetriggerCharacter(char ch); + [Obsolete("Implement TypeScriptTriggerCharacters instead", error: false)] + public virtual bool IsTriggerCharacter(char ch) => false; + + [Obsolete("Implement TypeScriptRetriggerCharacters instead", error: false)] + public virtual bool IsRetriggerCharacter(char ch) => false; + + public virtual ImmutableArray TypeScriptTriggerCharacters { get; } = []; + + public virtual ImmutableArray TypeScriptRetriggerCharacters { get; } = []; protected abstract Task GetItemsAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, CancellationToken cancellationToken); } diff --git a/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs b/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs index 3541d36653cda..d2b348584b2b5 100644 --- a/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs +++ b/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs @@ -27,13 +27,13 @@ internal abstract partial class AbstractSignatureHelpProvider : ISignatureHelpPr SymbolDisplayFormat.MinimallyQualifiedFormat.WithGenericsOptions( SymbolDisplayFormat.MinimallyQualifiedFormat.GenericsOptions & ~SymbolDisplayGenericsOptions.IncludeTypeParameters); + public abstract ImmutableArray TriggerCharacters { get; } + public abstract ImmutableArray RetriggerCharacters { get; } + protected AbstractSignatureHelpProvider() { } - public abstract bool IsTriggerCharacter(char ch); - public abstract bool IsRetriggerCharacter(char ch); - protected abstract Task GetItemsWorkerAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken); protected static SignatureHelpItems? CreateSignatureHelpItems( diff --git a/src/Features/Core/Portable/SignatureHelp/ISignatureHelpProvider.cs b/src/Features/Core/Portable/SignatureHelp/ISignatureHelpProvider.cs index 113bc5a128e6f..a6e0506bfe18e 100644 --- a/src/Features/Core/Portable/SignatureHelp/ISignatureHelpProvider.cs +++ b/src/Features/Core/Portable/SignatureHelp/ISignatureHelpProvider.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; @@ -10,16 +11,16 @@ namespace Microsoft.CodeAnalysis.SignatureHelp; internal interface ISignatureHelpProvider { /// - /// Returns true if the character might trigger completion, + /// The set of characters that might trigger a Signature Help session, /// e.g. '(' and ',' for method invocations /// - bool IsTriggerCharacter(char ch); + ImmutableArray TriggerCharacters { get; } /// - /// Returns true if the character might end a Signature Help session, + /// The set of characters that might end a Signature Help session, /// e.g. ')' for method invocations. /// - bool IsRetriggerCharacter(char ch); + ImmutableArray RetriggerCharacters { get; } /// /// Returns valid signature help items at the specified position in the document. diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/AddRemoveHandlerSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/AddRemoveHandlerSignatureHelpProvider.vb index 62de3f5f5daba..9372eb952549c 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/AddRemoveHandlerSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/AddRemoveHandlerSignatureHelpProvider.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.Host.Mef @@ -35,13 +36,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp token.IsChildToken(Of AddRemoveHandlerStatementSyntax)(Function(ce) ce.CommaToken) End Function - Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean - Return ch = " "c OrElse ch = ","c - End Function + Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create(" "c, ","c) - Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean - Return False - End Function + Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray(Of Char).Empty Protected Overrides Function IsArgumentListToken(node As AddRemoveHandlerStatementSyntax, token As SyntaxToken) As Boolean Return True diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/AttributeSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/AttributeSignatureHelpProvider.vb index ce05078afad17..e5e5f91776863 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/AttributeSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/AttributeSignatureHelpProvider.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis @@ -23,13 +24,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp Public Sub New() End Sub - Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean - Return ch = "("c OrElse ch = ","c - End Function + Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create("("c, ","c) - Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean - Return ch = ")"c - End Function + Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create(")"c) Private Function TryGetAttributeExpression(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, triggerReason As SignatureHelpTriggerReason, cancellationToken As CancellationToken, ByRef attribute As AttributeSyntax) As Boolean If Not CommonSignatureHelpUtilities.TryGetSyntax(root, position, syntaxFacts, triggerReason, AddressOf IsTriggerToken, AddressOf IsArgumentListToken, cancellationToken, attribute) Then diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/CastExpressionSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/CastExpressionSignatureHelpProvider.vb index a429f7ed3d14a..86e9cac9f069b 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/CastExpressionSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/CastExpressionSignatureHelpProvider.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.Host.Mef @@ -37,13 +38,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp token.IsChildToken(Of CastExpressionSyntax)(Function(ce) ce.CommaToken) End Function - Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean - Return ch = "("c OrElse ch = ","c - End Function + Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create("("c, ","c) - Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean - Return ch = ")"c - End Function + Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create(")"c) Protected Overrides Function IsArgumentListToken(node As CastExpressionSyntax, token As SyntaxToken) As Boolean Return node.Span.Contains(token.SpanStart) AndAlso diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/CollectionInitializerSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/CollectionInitializerSignatureHelpProvider.vb index 45155e10750ae..56acafe0aa155 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/CollectionInitializerSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/CollectionInitializerSignatureHelpProvider.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Composition Imports System.Runtime.InteropServices Imports System.Threading @@ -21,13 +22,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp Public Sub New() End Sub - Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean - Return ch = "{"c OrElse ch = ","c - End Function + Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create("{"c, ","c) - Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean - Return ch = "}"c - End Function + Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create("}"c) Private Function TryGetInitializerExpression(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, triggerReason As SignatureHelpTriggerReason, cancellationToken As CancellationToken, ByRef expression As CollectionInitializerSyntax) As Boolean Return CommonSignatureHelpUtilities.TryGetSyntax(root, position, syntaxFacts, triggerReason, AddressOf IsTriggerToken, AddressOf IsInitializerExpressionToken, cancellationToken, expression) AndAlso @@ -37,7 +34,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp Private Function IsTriggerToken(token As SyntaxToken) As Boolean Return Not token.IsKind(SyntaxKind.None) AndAlso token.ValueText.Length = 1 AndAlso - IsTriggerCharacter(token.ValueText(0)) AndAlso + TriggerCharacters.Contains(token.ValueText(0)) AndAlso TypeOf token.Parent Is CollectionInitializerSyntax End Function diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/ConditionalExpressionSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/ConditionalExpressionSignatureHelpProvider.vb index 0aa90ddcec620..9bbc7e8ebb0d4 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/ConditionalExpressionSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/ConditionalExpressionSignatureHelpProvider.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.Host.Mef @@ -24,13 +25,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp token.Parent.Kind = Kind End Function - Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean - Return ch = "("c OrElse ch = ","c - End Function + Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create("("c, ","c) - Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean - Return ch = ")"c - End Function + Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create(")"c) Protected Overrides Function IsArgumentListToken(node As T, token As SyntaxToken) As Boolean Return node.Span.Contains(token.SpanStart) AndAlso diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/FunctionAggregationSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/FunctionAggregationSignatureHelpProvider.vb index c60af0d3f5461..320684f1ac6ce 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/FunctionAggregationSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/FunctionAggregationSignatureHelpProvider.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.DocumentationComments @@ -22,13 +23,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp Public Sub New() End Sub - Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean - Return ch = "("c - End Function + Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create("("c) - Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean - Return ch = ")"c - End Function + Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create(")"c) Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState Dim functionAggregation As FunctionAggregationSyntax = Nothing diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/GenericNameSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/GenericNameSignatureHelpProvider.vb index 2a73b96530b4f..1650b1b6f6865 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/GenericNameSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/GenericNameSignatureHelpProvider.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.DocumentationComments @@ -22,13 +23,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp Public Sub New() End Sub - Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean - Return ch = " "c OrElse ch = ","c - End Function + Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create(" "c, ","c) - Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean - Return ch = ")"c - End Function + Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create(")"c) Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState? Dim expression As GenericNameSyntax = Nothing diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/GetTypeExpressionSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/GetTypeExpressionSignatureHelpProvider.vb index 24acfabaaf8bf..7dd0211f6bde3 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/GetTypeExpressionSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/GetTypeExpressionSignatureHelpProvider.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.Host.Mef @@ -27,13 +28,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp Return token.IsChildToken(Of GetTypeExpressionSyntax)(Function(ce) ce.OpenParenToken) End Function - Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean - Return ch = "("c - End Function + Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create("("c) - Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean - Return ch = ")"c - End Function + Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create(")"c) Protected Overrides Function IsArgumentListToken(node As GetTypeExpressionSyntax, token As SyntaxToken) As Boolean Return node.GetTypeKeyword <> token AndAlso diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/GetXmlNamespaceExpressionSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/GetXmlNamespaceExpressionSignatureHelpProvider.vb index f99fadd9374a9..00075d135c361 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/GetXmlNamespaceExpressionSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/GetXmlNamespaceExpressionSignatureHelpProvider.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.Host.Mef @@ -27,13 +28,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp Return token.IsChildToken(Of GetXmlNamespaceExpressionSyntax)(Function(ce) ce.OpenParenToken) End Function - Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean - Return ch = "("c - End Function + Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create("("c) - Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean - Return ch = ")"c - End Function + Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create(")"c) Protected Overrides Function IsArgumentListToken(node As GetXmlNamespaceExpressionSyntax, token As SyntaxToken) As Boolean Return node.GetXmlNamespaceKeyword <> token AndAlso diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.vb index b183b08aef08b..ec19c6c3e700d 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.vb @@ -23,13 +23,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp Public Sub New() End Sub - Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean - Return ch = "("c OrElse ch = ","c - End Function + Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create("("c, ","c) - Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean - Return ch = ")"c - End Function + Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create(")"c) Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState? Dim expression As InvocationExpressionSyntax = Nothing diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/MidAssignmentSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/MidAssignmentSignatureHelpProvider.vb index 1ecb682450b53..f1018b5454665 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/MidAssignmentSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/MidAssignmentSignatureHelpProvider.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.Host.Mef @@ -30,13 +31,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp token.Parent.Parent.IsParentKind(SyntaxKind.MidAssignmentStatement) End Function - Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean - Return ch = "("c OrElse ch = ","c - End Function + Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create("("c, ","c) - Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean - Return False - End Function + Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create(")"c) Protected Overrides Function IsArgumentListToken(node As AssignmentStatementSyntax, token As SyntaxToken) As Boolean Return node.Left.IsKind(SyntaxKind.MidExpression) AndAlso diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/NameOfExpressionSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/NameOfExpressionSignatureHelpProvider.vb index 279b463a10e42..df833a263ebd7 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/NameOfExpressionSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/NameOfExpressionSignatureHelpProvider.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.Host.Mef @@ -19,13 +20,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp Public Sub New() End Sub - Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean - Return ch = ")"c - End Function + Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create("("c) - Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean - Return ch = "("c - End Function + Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create(")"c) Protected Overrides Function GetIntrinsicOperatorDocumentationAsync(node As NameOfExpressionSyntax, document As Document, cancellationToken As CancellationToken) As ValueTask(Of IEnumerable(Of AbstractIntrinsicOperatorDocumentation)) Return New ValueTask(Of IEnumerable(Of AbstractIntrinsicOperatorDocumentation))({New NameOfExpressionDocumentation()}) diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.vb index c5b9e39ccb43d..7402cc1119036 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.DocumentationComments @@ -22,13 +23,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp Public Sub New() End Sub - Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean - Return ch = "("c OrElse ch = ","c - End Function + Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create("("c, ","c) - Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean - Return ch = ")"c - End Function + Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create(")"c) Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState? Dim expression As ObjectCreationExpressionSyntax = Nothing diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/PredefinedCastExpressionSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/PredefinedCastExpressionSignatureHelpProvider.vb index 247b7e5f6f409..db75a461e735b 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/PredefinedCastExpressionSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/PredefinedCastExpressionSignatureHelpProvider.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.Host.Mef @@ -31,13 +32,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp Return token.IsChildToken(Of PredefinedCastExpressionSyntax)(Function(ce) ce.OpenParenToken) End Function - Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean - Return ch = "("c - End Function + Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create("("c, ","c) - Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean - Return ch = ")"c - End Function + Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create(")"c) Protected Overrides Function IsArgumentListToken(node As PredefinedCastExpressionSyntax, token As SyntaxToken) As Boolean Return node.Keyword <> token AndAlso diff --git a/src/Features/VisualBasic/Portable/SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb b/src/Features/VisualBasic/Portable/SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb index 12e902814ac5e..acfbe505a74ca 100644 --- a/src/Features/VisualBasic/Portable/SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb +++ b/src/Features/VisualBasic/Portable/SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Composition Imports System.Threading Imports Microsoft.CodeAnalysis.DocumentationComments @@ -21,13 +22,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SignatureHelp Public Sub New() End Sub - Public Overrides Function IsTriggerCharacter(ch As Char) As Boolean - Return ch = "("c OrElse ch = ","c - End Function + Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create("("c, ","c) - Public Overrides Function IsRetriggerCharacter(ch As Char) As Boolean - Return False - End Function + Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray(Of Char).Empty Private Shared Function GetCurrentArgumentState(root As SyntaxNode, position As Integer, syntaxFacts As ISyntaxFactsService, currentSpan As TextSpan, cancellationToken As CancellationToken) As SignatureHelpState? Dim statement As RaiseEventStatementSyntax = Nothing diff --git a/src/LanguageServer/Protocol.TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs b/src/LanguageServer/Protocol.TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs index 99059d9987e55..711ee514b0a73 100644 --- a/src/LanguageServer/Protocol.TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs +++ b/src/LanguageServer/Protocol.TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs @@ -571,6 +571,8 @@ internal abstract class AbstractTestLspServer _languageServer; + private LSP.InitializeResult? _initializeResult; + public LSP.ClientCapabilities ClientCapabilities { get; } public AbstractTestLspServer( @@ -629,7 +631,7 @@ internal async Task InitializeAsync() if (_initializationOptions.CallInitialize) { - await this.ExecuteRequestAsync(LSP.Methods.InitializeName, new LSP.InitializeParams + _initializeResult = await this.ExecuteRequestAsync(LSP.Methods.InitializeName, new LSP.InitializeParams { Capabilities = _initializationOptions.ClientCapabilities, Locale = _initializationOptions.Locale, @@ -794,6 +796,12 @@ public async Task ExitTestServerAsync() public Solution GetCurrentSolution() => TestWorkspace.CurrentSolution; + public LSP.ServerCapabilities GetServerCapabilities() + { + Contract.ThrowIfNull(_initializeResult, "Initialize has not been called"); + return _initializeResult.Capabilities; + } + public async Task AssertServerShuttingDownAsync() { var queueAccessor = GetQueueAccessor()!.Value; diff --git a/src/LanguageServer/Protocol/DefaultCapabilitiesProvider.cs b/src/LanguageServer/Protocol/DefaultCapabilitiesProvider.cs index 055955ab89ace..a00b1f647ebfe 100644 --- a/src/LanguageServer/Protocol/DefaultCapabilitiesProvider.cs +++ b/src/LanguageServer/Protocol/DefaultCapabilitiesProvider.cs @@ -13,6 +13,7 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServer.Handler.Completion; using Microsoft.CodeAnalysis.LanguageServer.Handler.SemanticTokens; +using Microsoft.CodeAnalysis.SignatureHelp; using Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer; @@ -21,13 +22,16 @@ namespace Microsoft.CodeAnalysis.LanguageServer; internal sealed class ExperimentalCapabilitiesProvider : ICapabilitiesProvider { private readonly ImmutableArray> _completionProviders; + private readonly ImmutableArray> _signatureHelpProviders; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public ExperimentalCapabilitiesProvider( - [ImportMany] IEnumerable> completionProviders) + [ImportMany] IEnumerable> completionProviders, + [ImportMany] IEnumerable> signatureHelpProviders) { _completionProviders = [.. completionProviders.Where(lz => lz.Metadata.Language is LanguageNames.CSharp or LanguageNames.VisualBasic)]; + _signatureHelpProviders = [.. signatureHelpProviders.Where(lz => lz.Metadata.Language is LanguageNames.CSharp or LanguageNames.VisualBasic)]; } public void Initialize() @@ -39,6 +43,10 @@ public void Initialize() { _ = completionProvider.Value; } + foreach (var signatureHelpProvider in _signatureHelpProviders) + { + _ = signatureHelpProvider.Value; + } } public ServerCapabilities GetCapabilities(ClientCapabilities clientCapabilities) @@ -66,7 +74,12 @@ public ServerCapabilities GetCapabilities(ClientCapabilities clientCapabilities) TriggerCharacters = triggerCharacters, }; - capabilities.SignatureHelpProvider = new SignatureHelpOptions { TriggerCharacters = ["(", ","] }; + var signatureHelpTriggerCharacters = _signatureHelpProviders.SelectMany( + lz => lz.Value.TriggerCharacters).Distinct().Select(c => c.ToString()).ToArray(); + var signatureHelpRetriggerCharacters = _signatureHelpProviders.SelectMany( + lz => lz.Value.RetriggerCharacters).Distinct().Select(c => c.ToString()).ToArray(); + + capabilities.SignatureHelpProvider = new SignatureHelpOptions { TriggerCharacters = signatureHelpTriggerCharacters, RetriggerCharacters = signatureHelpRetriggerCharacters }; capabilities.DocumentSymbolProvider = true; capabilities.WorkspaceSymbolProvider = true; capabilities.DocumentFormattingProvider = true; diff --git a/src/LanguageServer/ProtocolUnitTests/SignatureHelp/SignatureHelpTests.cs b/src/LanguageServer/ProtocolUnitTests/SignatureHelp/SignatureHelpTests.cs index 64380f15407d7..5073b90d423a2 100644 --- a/src/LanguageServer/ProtocolUnitTests/SignatureHelp/SignatureHelpTests.cs +++ b/src/LanguageServer/ProtocolUnitTests/SignatureHelp/SignatureHelpTests.cs @@ -22,21 +22,23 @@ public SignatureHelpTests(ITestOutputHelper testOutputHelper) : base(testOutputH public async Task TestGetSignatureHelpAsync(bool mutatingLspWorkspace) { var markup = -@"class A -{ - void M() - { - M2({|caret:|}'a'); - } - /// - /// M2 is a method. - /// - int M2(string a) - { - return 1; - } + """ + class A + { + void M() + { + M2({|caret:|}'a'); + } + /// + /// M2 is a method. + /// + int M2(string a) + { + return 1; + } -}"; + } + """; await using var testLspServer = await CreateTestLspServerAsync(markup, mutatingLspWorkspace); var expected = new LSP.SignatureHelp() { @@ -53,13 +55,15 @@ int M2(string a) public async Task TestGetNestedSignatureHelpAsync(bool mutatingLspWorkspace) { var markup = -@"class Foo { - public Foo(int showMe) {} + """ + class Foo { + public Foo(int showMe) {} - public static void Do(Foo foo) { - Do(new Foo({|caret:|} - } -}"; + public static void Do(Foo foo) { + Do(new Foo({|caret:|} + } + } + """; await using var testLspServer = await CreateTestLspServerAsync(markup, mutatingLspWorkspace); var expected = new LSP.SignatureHelp() { @@ -72,6 +76,33 @@ public static void Do(Foo foo) { AssertJsonEquals(expected, results); } + [Theory, CombinatorialData, WorkItem("https://github.com/dotnet/vscode-csharp/issues/8154")] + public async Task TestGetSignatureHelpInGenericAsync(bool mutatingLspWorkspace) + { + var markup = + """ + using System.Collections.Generic; + class A + { + Dictionary<{|caret:|} + } + """; + await using var testLspServer = await CreateTestLspServerAsync(markup, mutatingLspWorkspace); + + var results = await RunGetSignatureHelpAsync(testLspServer, testLspServer.GetLocations("caret").Single()); + Assert.Equal(1, results?.Signatures.Length); + Assert.Equal("Dictionary", results?.Signatures[0].Label); + } + + [Theory, CombinatorialData, WorkItem("https://github.com/dotnet/vscode-csharp/issues/8154")] + public async Task TestGetSignatureHelpServerCapabilitiesAsync(bool mutatingLspWorkspace) + { + await using var testLspServer = await CreateTestLspServerAsync(string.Empty, mutatingLspWorkspace); + Assert.Contains("(", testLspServer.GetServerCapabilities().SignatureHelpProvider!.TriggerCharacters!); + Assert.Contains("<", testLspServer.GetServerCapabilities().SignatureHelpProvider!.TriggerCharacters!); + Assert.Contains("{", testLspServer.GetServerCapabilities().SignatureHelpProvider!.TriggerCharacters!); + } + private static async Task RunGetSignatureHelpAsync(TestLspServer testLspServer, LSP.Location caret) { return await testLspServer.ExecuteRequestAsync( diff --git a/src/VisualStudio/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpProvider.cs b/src/VisualStudio/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpProvider.cs index bb64053977a6e..1432fae139f30 100644 --- a/src/VisualStudio/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpProvider.cs +++ b/src/VisualStudio/ExternalAccess/FSharp/Internal/SignatureHelp/FSharpSignatureHelpProvider.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Linq; using System.Composition; @@ -12,6 +10,7 @@ using Microsoft.CodeAnalysis.ExternalAccess.FSharp.SignatureHelp; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.SignatureHelp; +using System.Collections.Immutable; namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.SignatureHelp; @@ -19,25 +18,50 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.SignatureHelp; [ExportSignatureHelpProvider(nameof(FSharpSignatureHelpProvider), LanguageNames.FSharp)] internal class FSharpSignatureHelpProvider : ISignatureHelpProvider { - private readonly IFSharpSignatureHelpProvider _provider; +#pragma warning disable CS0618 // Type or member is obsolete + private readonly IFSharpSignatureHelpProvider? _legacyProvider; +#pragma warning restore CS0618 // Type or member is obsolete + private readonly AbstractFSharpSignatureHelpProvider? _newProvider; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public FSharpSignatureHelpProvider(IFSharpSignatureHelpProvider provider) + public FSharpSignatureHelpProvider( + [Import(AllowDefault = true)] IFSharpSignatureHelpProvider? legacyProvider, + [Import(AllowDefault = true)] AbstractFSharpSignatureHelpProvider? newProvider) { - _provider = provider; + _legacyProvider = legacyProvider; + _newProvider = newProvider; } - public async Task GetItemsAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) + /// + /// Hard coded from https://github.com/dotnet/fsharp/blob/main/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs#L708 + /// + public ImmutableArray TriggerCharacters => _newProvider is not null ? _newProvider.TriggerCharacters : ['(', '<', ',', ' ']; + + /// + /// Hard coded from https://github.com/dotnet/fsharp/blob/main/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs#L712C48-L712C73 + /// + public ImmutableArray RetriggerCharacters => _newProvider is not null ? _newProvider.RetriggerCharacters : [')', '>', '=']; + + public async Task GetItemsAsync(Document document, int position, SignatureHelpTriggerInfo triggerInfo, MemberDisplayOptions options, CancellationToken cancellationToken) { var mappedTriggerReason = FSharpSignatureHelpTriggerReasonHelpers.ConvertFrom(triggerInfo.TriggerReason); var mappedTriggerInfo = new FSharpSignatureHelpTriggerInfo(mappedTriggerReason, triggerInfo.TriggerCharacter); - var mappedSignatureHelpItems = await _provider.GetItemsAsync(document, position, mappedTriggerInfo, cancellationToken).ConfigureAwait(false); + FSharpSignatureHelpItems mappedSignatureHelpItems; + if (_newProvider is not null) + { + mappedSignatureHelpItems = await _newProvider.GetItemsAsync(document, position, mappedTriggerInfo, cancellationToken).ConfigureAwait(false); + } + else + { + Contract.ThrowIfNull(_legacyProvider, "Either the new or legacy provider must be available"); + mappedSignatureHelpItems = await _legacyProvider.GetItemsAsync(document, position, mappedTriggerInfo, cancellationToken).ConfigureAwait(false); + } if (mappedSignatureHelpItems != null) { return new SignatureHelpItems( - mappedSignatureHelpItems.Items?.Select(x => + mappedSignatureHelpItems.Items.Select(x => new SignatureHelpItem( x.IsVariadic, x.DocumentationFactory, @@ -65,14 +89,4 @@ public async Task GetItemsAsync(Document document, int posit return null; } } - - public bool IsRetriggerCharacter(char ch) - { - return _provider.IsRetriggerCharacter(ch); - } - - public bool IsTriggerCharacter(char ch) - { - return _provider.IsTriggerCharacter(ch); - } } diff --git a/src/VisualStudio/ExternalAccess/FSharp/InternalAPI.Unshipped.txt b/src/VisualStudio/ExternalAccess/FSharp/InternalAPI.Unshipped.txt index f5bd0244c11a9..7b4664588f178 100644 --- a/src/VisualStudio/ExternalAccess/FSharp/InternalAPI.Unshipped.txt +++ b/src/VisualStudio/ExternalAccess/FSharp/InternalAPI.Unshipped.txt @@ -10,6 +10,7 @@ abstract Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.FSharpInlineRenameI abstract Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.FSharpInlineRenameInfo.TriggerSpan.get -> Microsoft.CodeAnalysis.Text.TextSpan abstract Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.FSharpInlineRenameReplacementInfo.ReplacementTextValid.get -> bool abstract Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor.FSharpInlineRenameServiceImplementation.GetRenameInfoAsync(Microsoft.CodeAnalysis.Document! document, int position, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! +abstract Microsoft.CodeAnalysis.ExternalAccess.FSharp.SignatureHelp.AbstractFSharpSignatureHelpProvider.GetItemsAsync(Microsoft.CodeAnalysis.Document! document, int position, Microsoft.CodeAnalysis.ExternalAccess.FSharp.SignatureHelp.FSharpSignatureHelpTriggerInfo triggerInfo, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! Microsoft.CodeAnalysis.ExternalAccess.FSharp.Classification.FSharpClassificationTags Microsoft.CodeAnalysis.ExternalAccess.FSharp.Classification.IFSharpClassificationService Microsoft.CodeAnalysis.ExternalAccess.FSharp.Completion.FSharpCommonCompletionItem @@ -624,3 +625,4 @@ static Microsoft.CodeAnalysis.ExternalAccess.FSharp.TaskList.FSharpTaskListItem. ~static Microsoft.CodeAnalysis.ExternalAccess.FSharp.Structure.FSharpBlockTypes.PreprocessorRegion.get -> string ~static Microsoft.CodeAnalysis.ExternalAccess.FSharp.Structure.FSharpBlockTypes.Statement.get -> string ~static Microsoft.CodeAnalysis.ExternalAccess.FSharp.Structure.FSharpBlockTypes.Type.get -> string +~static Microsoft.CodeAnalysis.ExternalAccess.FSharp.Structure.FSharpBlockTypes.Type.get -> string diff --git a/src/VisualStudio/ExternalAccess/FSharp/SignatureHelp/AbstractFSharpSignatureHelpProvider.cs b/src/VisualStudio/ExternalAccess/FSharp/SignatureHelp/AbstractFSharpSignatureHelpProvider.cs new file mode 100644 index 0000000000000..1903cc1f3460a --- /dev/null +++ b/src/VisualStudio/ExternalAccess/FSharp/SignatureHelp/AbstractFSharpSignatureHelpProvider.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.SignatureHelp; + +internal abstract class AbstractFSharpSignatureHelpProvider +{ + /// + /// The set of characters that might trigger a Signature Help session, + /// e.g. '(' and ',' for method invocations + /// + public abstract ImmutableArray TriggerCharacters { get; } + + /// + /// The set of characters that might end a Signature Help session, + /// e.g. ')' for method invocations. + /// + public abstract ImmutableArray RetriggerCharacters { get; } + + /// + /// Returns valid signature help items at the specified position in the document. + /// + public abstract Task GetItemsAsync(Document document, int position, FSharpSignatureHelpTriggerInfo triggerInfo, CancellationToken cancellationToken); +} \ No newline at end of file diff --git a/src/VisualStudio/ExternalAccess/FSharp/SignatureHelp/IFSharpSignatureHelpProvider.cs b/src/VisualStudio/ExternalAccess/FSharp/SignatureHelp/IFSharpSignatureHelpProvider.cs index ea9eb4aa66fb1..9fbb6d0abfc3b 100644 --- a/src/VisualStudio/ExternalAccess/FSharp/SignatureHelp/IFSharpSignatureHelpProvider.cs +++ b/src/VisualStudio/ExternalAccess/FSharp/SignatureHelp/IFSharpSignatureHelpProvider.cs @@ -4,11 +4,13 @@ #nullable disable +using System; using System.Threading; using System.Threading.Tasks; namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.SignatureHelp; +[Obsolete("Use Microsoft.CodeAnalysis.ExternalAccess.FSharp.SignatureHelp.AbstractFSharpSignatureHelpProvider instead.")] internal interface IFSharpSignatureHelpProvider { ///