Add signatureHelp (parameter hints) to the LSP WebSocket API#357
Closed
kishikawakatsumi wants to merge 1 commit into
Closed
Add signatureHelp (parameter hints) to the LSP WebSocket API#357kishikawakatsumi wants to merge 1 commit into
kishikawakatsumi wants to merge 1 commit into
Conversation
sourcekit-lsp (main) now implements textDocument/signatureHelp, so expose it: a `signatureHelp` method that forwards the cursor position and returns the SignatureHelp response (signatures, parameters, activeParameter) to the client. This backs Xcode-style parameter hints in the editor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR exposes LSP textDocument/signatureHelp over the existing WebSocket bridge so the web editor can display Swift/Xcode-style parameter hints (signatures, parameters, and activeParameter) via the signatureHelp WebSocket method.
Changes:
- Add a
signatureHelpWebSocket request/response shape and handler inroutes.swift. - Add
LanguageServer.sendSignatureHelpRequest(documentPath:line:character:)to issueSignatureHelpRequestto sourcekit-lsp.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Sources/App/routes.swift | Adds signatureHelp message types and WebSocket routing to call into the language server and return the LSP SignatureHelp payload. |
| Sources/App/Controllers/LanguageServer.swift | Adds a new helper method to send textDocument/signatureHelp over the existing JSON-RPC connection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Exposes
textDocument/signatureHelpover the WebSocket bridge so the editor can show Xcode-style parameter hints.sourcekit-lsp on
mainnow implements signature help (SwiftLanguageService/SignatureHelp.swift), so this just wires it through:LanguageServer.sendSignatureHelpRequest(documentPath:line:character:)issuestextDocument/signatureHelp.routes.swifthandles a newsignatureHelpWebSocket method and returns{ method, id, value }wherevalueis the LSPSignatureHelp(signatures / parameters / activeParameter).Verified end-to-end against a locally rebuilt image: for
greet(name: String, times: Int), requesting signature help inside the call returns the signature label and parameter ranges, andactiveParametercorrectly advances from0to1as the cursor moves past the comma.The companion frontend change (Monaco
registerSignatureHelpProvider+ thesignatureHelprequest, plus completion-trigger improvements) is in the swiftfiddle-web repo.🤖 Generated with Claude Code