-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Ensure LSP uses actual signature help trigger characters #78076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,20 +28,17 @@ namespace Microsoft.CodeAnalysis.CSharp.SignatureHelp; | |
[ExportSignatureHelpProvider("ElementAccessExpressionSignatureHelpProvider", LanguageNames.CSharp), Shared] | ||
internal sealed class ElementAccessExpressionSignatureHelpProvider : AbstractCSharpSignatureHelpProvider | ||
{ | ||
private static readonly ImmutableArray<char> s_triggerCharacters = ['[', ',']; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could remove and do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is used in a bunch of static classes and methods - found it easier to do this than change the rest of the callers |
||
|
||
[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<char> TriggerCharacters => s_triggerCharacters; | ||
|
||
public override bool IsRetriggerCharacter(char ch) | ||
=> ch == ']'; | ||
public override ImmutableArray<char> 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]) && | ||
dibarbet marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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; | ||
|
Uh oh!
There was an error while loading. Please reload this page.