-
Notifications
You must be signed in to change notification settings - Fork 7
Implement signature help #34
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
046e280
Implement "signature help"
mlechu a8f92d2
misc fixes
mlechu 359ed79
Detect when we're in a method definition and suppress signature help
mlechu a5b631c
Small fixes
mlechu 00d478f
Some tests. Param highlighting TODO
mlechu a97153b
Param highlighting tests and small tweaks
mlechu c1df48f
Update src/LSP/language-features/signature-help.jl
mlechu 68ef7da
Merge remote-tracking branch 'origin/master' into ec/signature-help
aviatesk 02fc549
adjustments to the latest master
aviatesk d1f3b5e
fix `var"..."` nonsense from JET internals, add full tests
aviatesk 11f9739
support dymamic registration of signature help
aviatesk 3f05750
add commented out dynamic registrations hack
aviatesk 11f708a
Apply suggestions from code review
mlechu 8852b81
Use `JL.SyntaxList` instead of `Vector{JL.SyntaxTree}`
mlechu 5efb6c1
Don't filter on keyword arg if the cursor could be editing its name
mlechu 110225e
Fix vararg off-by-one causing highlighting failure
mlechu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,251 @@ | ||
| @interface SignatureHelpClientCapabilities begin | ||
| """ | ||
| Whether signature help supports dynamic registration. | ||
| """ | ||
| dynamicRegistration::Union{Nothing, Bool} = nothing | ||
|
|
||
| """ | ||
| The client supports the following `SignatureInformation` | ||
| specific properties. | ||
| """ | ||
| signatureInformation::Union{Nothing, @interface begin | ||
| """ | ||
| Client supports the follow content formats for the documentation | ||
| property. The order describes the preferred format of the client. | ||
| """ | ||
| documentationFormat::Union{Nothing, Vector{MarkupKind}} = nothing | ||
|
|
||
| """ | ||
| Client capabilities specific to parameter information. | ||
| """ | ||
| parameterInformation::Union{Nothing, @interface begin | ||
| """ | ||
| The client supports processing label offsets instead of a | ||
| simple label string. | ||
|
|
||
| # Tags | ||
| - since - 3.14.0 | ||
| """ | ||
| labelOffsetSupport::Union{Nothing, Bool} = nothing | ||
| end} = nothing | ||
|
|
||
| """ | ||
| The client supports the `activeParameter` property on | ||
| `SignatureInformation` literal. | ||
|
|
||
| # Tags | ||
| - since - 3.16.0 | ||
| """ | ||
| activeParameterSupport::Union{Nothing, Bool} = nothing | ||
| end} = nothing | ||
|
|
||
| """ | ||
| The client supports to send additional context information for a | ||
| `textDocument/signatureHelp` request. A client that opts into | ||
| contextSupport will also support the `retriggerCharacters` on | ||
| `SignatureHelpOptions`. | ||
|
|
||
| # Tags | ||
| - since - 3.15.0 | ||
| """ | ||
| contextSupport::Union{Nothing, Bool} = nothing | ||
| end | ||
|
|
||
| @interface SignatureHelpOptions @extends WorkDoneProgressOptions begin | ||
| """ | ||
| The characters that trigger signature help | ||
| automatically. | ||
| """ | ||
| triggerCharacters::Union{Nothing, Vector{String}} = nothing | ||
|
|
||
| """ | ||
| List of characters that re-trigger signature help. | ||
|
|
||
| These trigger characters are only active when signature help is already | ||
| showing. All trigger characters are also counted as re-trigger | ||
| characters. | ||
|
|
||
| # Tags | ||
| - since - 3.15.0 | ||
| """ | ||
| retriggerCharacters::Union{Nothing, Vector{String}} = nothing | ||
| end | ||
|
|
||
| @interface SignatureHelpRegistrationOptions @extends TextDocumentRegistrationOptions, SignatureHelpOptions begin | ||
| end | ||
|
|
||
| """ | ||
| How a signature help was triggered. | ||
|
|
||
| # Tags | ||
| - since - 3.15.0 | ||
| """ | ||
| @namespace SignatureHelpTriggerKind::Int begin | ||
| """ | ||
| Signature help was invoked manually by the user or by a command. | ||
| """ | ||
| Invoked = 1 | ||
| """ | ||
| Signature help was triggered by a trigger character. | ||
| """ | ||
| TriggerCharacter = 2 | ||
| """ | ||
| Signature help was triggered by the cursor moving or by the document | ||
| content changing. | ||
| """ | ||
| ContentChange = 3 | ||
| end | ||
|
|
||
| """ | ||
| Represents a parameter of a callable-signature. A parameter can | ||
| have a label and a doc-comment. | ||
| """ | ||
| @interface ParameterInformation begin | ||
|
|
||
| """ | ||
| The label of this parameter information. | ||
|
|
||
| Either a string or an inclusive start and exclusive end offsets within | ||
| its containing signature label. (see SignatureInformation.label). The | ||
| offsets are based on a UTF-16 string representation as `Position` and | ||
| `Range` does. | ||
|
|
||
| *Note*: a label of type string should be a substring of its containing | ||
| signature label. Its intended use case is to highlight the parameter | ||
| label part in the `SignatureInformation.label`. | ||
| """ | ||
| label::Union{String, Vector{UInt}} # vector should have length 2 | ||
|
|
||
| """ | ||
| The human-readable doc-comment of this parameter. Will be shown | ||
| in the UI but can be omitted. | ||
| """ | ||
| documentation::Union{Nothing, String, MarkupContent} = nothing | ||
| end | ||
|
|
||
| """ | ||
| Represents the signature of something callable. A signature | ||
| can have a label, like a function-name, a doc-comment, and | ||
| a set of parameters. | ||
| """ | ||
| @interface SignatureInformation begin | ||
| """ | ||
| The label of this signature. Will be shown in | ||
| the UI. | ||
| """ | ||
| label::String | ||
|
|
||
| """ | ||
| The human-readable doc-comment of this signature. Will be shown | ||
| in the UI but can be omitted. | ||
| """ | ||
| documentation::Union{Nothing, String, MarkupContent} = nothing | ||
|
|
||
| """ | ||
| The parameters of this signature. | ||
| """ | ||
| parameters::Union{Nothing, Vector{ParameterInformation}} = nothing | ||
|
|
||
| """ | ||
| The index of the active parameter. | ||
|
|
||
| If provided, this is used in place of `SignatureHelp.activeParameter`. | ||
|
|
||
| # Tags | ||
| - since - 3.16.0 | ||
| """ | ||
| activeParameter::Union{Nothing, UInt} = nothing | ||
| end | ||
|
|
||
| """ | ||
| Signature help represents the signature of something | ||
| callable. There can be multiple signature but only one | ||
| active and only one active parameter. | ||
| """ | ||
| @interface SignatureHelp begin | ||
| """ | ||
| One or more signatures. If no signatures are available the signature help | ||
| request should return `null`. | ||
| """ | ||
| signatures::Vector{SignatureInformation} | ||
|
|
||
| """ | ||
| The active signature. If omitted or the value lies outside the | ||
| range of `signatures` the value defaults to zero or is ignore if | ||
| the `SignatureHelp` as no signatures. | ||
|
|
||
| Whenever possible implementors should make an active decision about | ||
| the active signature and shouldn't rely on a default value. | ||
|
|
||
| In future version of the protocol this property might become | ||
| mandatory to better express this. | ||
| """ | ||
| activeSignature::Union{Nothing, UInt} = nothing | ||
|
|
||
| """ | ||
| The active parameter of the active signature. If omitted or the value | ||
| lies outside the range of `signatures[activeSignature].parameters` | ||
| defaults to 0 if the active signature has parameters. If | ||
| the active signature has no parameters it is ignored. | ||
| In future version of the protocol this property might become | ||
| mandatory to better express the active parameter if the | ||
| active signature does have any. | ||
| """ | ||
| activeParameter::Union{Nothing, UInt} = nothing | ||
| end | ||
|
|
||
| """ | ||
| Additional information about the context in which a signature help request | ||
| was triggered. | ||
|
|
||
| # Tags | ||
| - since - 3.15.0 | ||
| """ | ||
| @interface SignatureHelpContext begin | ||
| """ | ||
| Action that caused signature help to be triggered. | ||
| """ | ||
| triggerKind::SignatureHelpTriggerKind.Ty | ||
|
|
||
| """ | ||
| Character that caused signature help to be triggered. | ||
|
|
||
| This is undefined when triggerKind !== | ||
| SignatureHelpTriggerKind.TriggerCharacter | ||
| """ | ||
| triggerCharacter::Union{Nothing, String} = nothing | ||
|
|
||
| """ | ||
| `true` if signature help was already showing when it was triggered. | ||
|
|
||
| Retriggers occur when the signature help is already active and can be | ||
| caused by actions such as typing a trigger character, a cursor move, or | ||
| document content changes. | ||
| """ | ||
| isRetrigger::Bool | ||
|
|
||
| """ | ||
| The currently active `SignatureHelp`. | ||
|
|
||
| The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field | ||
| updated based on the user navigating through available signatures. | ||
| """ | ||
| activeSignatureHelp::Union{Nothing, SignatureHelp} = nothing | ||
| end | ||
|
|
||
| @interface SignatureHelpParams @extends TextDocumentPositionParams, WorkDoneProgressParams begin | ||
| """ | ||
| The signature help context. This is only available if the client | ||
| specifies to send this using the client capability | ||
| `textDocument.signatureHelp.contextSupport === true` | ||
|
|
||
| # Tags | ||
| - since - 3.15.0 | ||
| """ | ||
| context::Union{Nothing, SignatureHelpContext} = nothing | ||
| end | ||
|
|
||
| @interface SignatureHelpRequest @extends RequestMessage begin | ||
| method::String = "textDocument/signatureHelp" | ||
| params::SignatureHelpParams | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.