[Repo Assist] fix: improve delegate type tooltips using FSharpDelegateSignature API#1485
Conversation
Closes #627 The previous implementation used getFuncSignatureWithIdent on the delegate's Invoke method, which produced badly formatted multi-line output with excess indentation. For no-argument delegates the output was especially broken (just 'unit' with no indentation). Replace with direct use of FSharpEntity.FSharpDelegateSignature, which provides the delegate arguments (with optional names) and return type. This produces a clean single-line format: type MyDelegate = delegate of arg: string -> int instead of: type MyDelegate = delegate of arg: string -> int For zero-argument delegates, 'unit' is shown as the argument type, consistent with F# delegate syntax. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/repo-assist add tests to it, including e2e hover test |
Add e2e hover tests (verifySignature) that verify the delegate type signature formatter produces clean output: - NoArgDelegate (unit -> unit) - SingleArgDelegate (named arg -> int) - MultiArgDelegate (two named args -> bool) - UnannotatedDelegate (unnamed arg -> int) Also add a DocumentationFormatter test via the FSharpDocumentation endpoint (InfoPanelTests) to cover the parallel change in DocumentationFormatter.fs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Commit pushed:
|
|
🤖 This is an automated response from Repo Assist. Done! I've added tests for the delegate tooltip fix. Here's what was added: E2E Hover Tests (SignatureFormatter path)Added 4
These exercise the DocumentationFormatter TestAdded one test case to Build status✅ Build succeeded (
|
…ip fix) to v0.84.0 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🤖 This is an automated pull request from Repo Assist.
Fixes #627 — Tooltips for delegates are terrible
Root Cause
The
delegateTipfunction in bothSignatureFormatter.fsandDocumentationFormatter.fswas callinggetFuncSignatureWithIdenton the delegate'sInvokemethod withident=6. This function is designed for member signatures with alignment padding, producing awkward multi-line output for delegates.For no-argument delegates (e.g.
System.Action), the result was especially broken: the[ [] ]branch withisDelegate=truereturned just"unit"with no indentation, giving:Changes
src/FsAutoComplete.Core/SignatureFormatter.fs— updateddelegateTipsrc/FsAutoComplete.Core/DocumentationFormatter.fs— updateddelegateTipTest Status
✅
src/FsAutoComplete.Corebuilds successfully (dotnet build -f net8.0)✅
src/FsAutoComplete(main LSP server) builds successfully✅ Code formatted with
dotnet fantomas(no changes needed)Note: The full solution build has a pre-existing failure in
test/FsAutoComplete.DependencyManager.Dummytargetingnetstandard2.0only, unrelated to these changes.