Skip to content

Add signatureHelp (parameter hints) to the LSP WebSocket API#358

Merged
kishikawakatsumi merged 1 commit into
mainfrom
feature/signature-help
Jun 11, 2026
Merged

Add signatureHelp (parameter hints) to the LSP WebSocket API#358
kishikawakatsumi merged 1 commit into
mainfrom
feature/signature-help

Conversation

@kishikawakatsumi

Copy link
Copy Markdown
Member

Exposes textDocument/signatureHelp over the WebSocket bridge so the editor can show Xcode-style parameter hints.

sourcekit-lsp on main now implements signature help (SwiftLanguageService/SignatureHelp.swift), so this just wires it through:

  • LanguageServer.sendSignatureHelpRequest(documentPath:line:character:) issues textDocument/signatureHelp.
  • routes.swift handles a new signatureHelp WebSocket method and returns { method, id, value } where value is the LSP SignatureHelp (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, and activeParameter correctly advances from 0 to 1 as the cursor moves past the comma.

The companion frontend change (Monaco registerSignatureHelpProvider + the signatureHelp request, plus completion-trigger improvements) is in SwiftFiddle/swiftfiddle-web#1234.

Supersedes #357, which GitHub auto-closed when its stacked base branch was deleted on merge of #356. Same commit, now based directly on main.

🤖 Generated with Claude Code

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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR exposes LSP textDocument/signatureHelp through the existing WebSocket bridge so the SwiftFiddle editor can request and display parameter hints (signatures/parameters/activeParameter) from sourcekit-lsp.

Changes:

  • Add a new WebSocket signatureHelp method handler that forwards to the language server and returns { method, id, value }.
  • Add LanguageServer.sendSignatureHelpRequest(documentPath:line:character:) to issue SignatureHelpRequest over the JSON-RPC connection.

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 request/response message types and a WebSocket route case that forwards the request and returns the LSP response payload.
Sources/App/Controllers/LanguageServer.swift Adds a helper to send SignatureHelpRequest to sourcekit-lsp using the existing JSONRPCConnection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kishikawakatsumi kishikawakatsumi merged commit 59710eb into main Jun 11, 2026
3 checks passed
@kishikawakatsumi kishikawakatsumi deleted the feature/signature-help branch June 11, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants