Skip to content

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

Closed
kishikawakatsumi wants to merge 1 commit into
fix/lsp-leak-hover-formatfrom
feature/signature-help
Closed

Add signatureHelp (parameter hints) to the LSP WebSocket API#357
kishikawakatsumi wants to merge 1 commit into
fix/lsp-leak-hover-formatfrom
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 the swiftfiddle-web repo.

Note: stacked on #356 (base fix/lsp-leak-hover-project); retarget to main once that merges. Signature help benefits from the initialized notification added there.

🤖 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 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 signatureHelp WebSocket request/response shape and handler in routes.swift.
  • Add LanguageServer.sendSignatureHelpRequest(documentPath:line:character:) to issue SignatureHelpRequest to 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.

@kishikawakatsumi

Copy link
Copy Markdown
Member Author

Superseded by #358 (rebased onto main after #356 merged). GitHub auto-closed this when the stacked base branch fix/lsp-leak-hover-format was deleted.

@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