-
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
Ensure LSP uses actual signature help trigger characters #78076
Conversation
@@ -14,11 +16,50 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api; | |||
/// </summary> | |||
internal abstract class VSTypeScriptSignatureHelpProviderBase : ISignatureHelpProvider | |||
{ | |||
public ImmutableArray<char> TriggerCharacters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was the easiest way I could come up with to avoid a dual insertion.
once we have packages I'll submit a PR to TS to switch to the new properties, then we can delete the hardcoded characters.
/// <summary> | ||
/// Hard coded from https://github.com/dotnet/fsharp/blob/main/vsintegration/src/FSharp.Editor/Completion/SignatureHelp.fs#L708 | ||
/// </summary> | ||
public ImmutableArray<char> TriggerCharacters => _newProvider is not null ? _newProvider.TriggerCharacters : ['(', '<', ',', ' ']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was the easiest way I could come up with to avoid a dual insertion.
once we have packages inserted I'll submit a PR to F# to switch to the new properties, then we can delete the hardcoded characters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup. this makes sense to me.
@@ -66,7 +74,12 @@ public ServerCapabilities GetCapabilities(ClientCapabilities clientCapabilities) | |||
TriggerCharacters = triggerCharacters, | |||
}; | |||
|
|||
capabilities.SignatureHelpProvider = new SignatureHelpOptions { TriggerCharacters = ["(", ","] }; | |||
var signatureHelpTriggerCharacters = _signatureHelpProviders.SelectMany( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the main part of the fix. rest is basically just updating based on the interface changes
src/VisualStudio/ExternalAccess/FSharp/SignatureHelp/IFSharpSignatureHelpProvider.cs
Outdated
Show resolved
Hide resolved
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
could remove and do TriggerCharaacters { get; } = ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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
src/Features/CSharp/Portable/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs
Show resolved
Hide resolved
Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) | ||
Get | ||
Return ImmutableArray.Create(" "c, ","c) | ||
End Get | ||
End Property | ||
|
||
Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) | ||
Get | ||
Return ImmutableArray(Of Char).Empty | ||
End Get | ||
End Property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) | |
Get | |
Return ImmutableArray.Create(" "c, ","c) | |
End Get | |
End Property | |
Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) | |
Get | |
Return ImmutableArray(Of Char).Empty | |
End Get | |
End Property | |
Public Overrides ReadOnly Property TriggerCharacters As ImmutableArray(Of Char) = ImmutableArray.Create(" "c, ","c) | |
Public Overrides ReadOnly Property RetriggerCharacters As ImmutableArray(Of Char) = ImmutableArray(Of Char).Empty |
Resolves dotnet/vscode-csharp#8154