[Repo Assist] fix: show default parameter values concisely in signature help#1512
Merged
Krzysztof-Cieslak merged 3 commits intomainfrom Mar 24, 2026
Conversation
When a C#-style optional parameter is decorated with
[<Optional; DefaultParameterValue(value)>], signature help previously
showed the full verbose attribute syntax, e.g.:
[<System.Runtime.InteropServices.Optional;
System.Runtime.InteropServices.DefaultParameterValue("")>] args: string
Now the attribute block is stripped and the default value is shown inline:
args: string = ""
If no DefaultParameterValue is present (only [<Optional>]), the attribute
is silently removed leaving just the clean name: type display.
Implementation: add TipFormatter.cleanParameterDisplay which uses a regex
to detect [<...>] blocks, extract any DefaultParameterValue argument, and
reconstruct the parameter string. Use it in TextDocumentSignatureHelp
parameter documentation.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
|
/repo-assist add tests |
Contributor
Author
|
✅ Repo Assist completed successfully! |
Cover the following scenarios: - Full verbose C# interop attributes (Optional + DefaultParameterValue) with string default - Short-form Optional+DefaultParameterValue with string default - Numeric default value - Boolean default value - Optional-only (no DefaultParameterValue) — attribute stripped, no suffix - Plain parameter with no attribute — returned unchanged - Multiple tagged-text segments concatenated before processing All 7 new tests pass alongside the 8 pre-existing TipFormatter tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
Commit pushed:
|
Contributor
Author
|
🤖 Repo Assist — automated AI assistant Added 7 unit tests for
All 15 TipFormatter tests (8 pre-existing + 7 new) pass. ✅
|
github-actions bot
added a commit
that referenced
this pull request
Mar 25, 2026
…#1512); update date Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9 tasks
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.
🤖 Repo Assist — automated AI assistant
Closes #1310
Problem
When a method has C#-style optional parameters with
[(System.Runtime.InteropServices.Optional; System.Runtime.InteropServices.DefaultParameterValue(...))]attributes, the signature help parameter documentation showed the full verbose attribute syntax:If no
DefaultParameterValueis present (only[(Optional)]), the attribute block is removed cleanly.The fix applies to
TextDocumentSignatureHelpparameter documentation, which is what editors display to highlight each parameter as the user types arguments.Changes
src/FsAutoComplete.Core/TipFormatter.fs— addcleanParameterDisplay : TaggedText[] -> stringsrc/FsAutoComplete.Core/TipFormatter.fsi— expose in the module signaturesrc/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs— usecleanParameterDisplayinTextDocumentSignatureHelpTrade-offs
The regex
\[<[^\]]*>\]handles the common case of simple attribute arguments (string/number/bool literals). Pathological cases where attribute constructor arguments contain](extremely rare in practice forDefaultParameterValue) would not be transformed, leaving the original verbose text as a safe fallback.Test Status
dotnet build src/FsAutoComplete.Core/FsAutoComplete.Core.fsproj -f net8.0→ Build succeeded (0 errors, 0 warnings)