Fix IntelliSense dropping named argument suggestions after first completion#19940
Fix IntelliSense dropping named argument suggestions after first completion#19940T-Gro wants to merge 5 commits into
Conversation
TDD red: 4 bug-reproduction tests + 3 regression guards added to CompletionTests.fs. Baseline on this branch HEAD (net10.0, before any production fix): - 3 of 4 bug tests FAIL as expected: overloaded Task.Factory.StartNew (2nd/3rd arg partial), optional args (2nd arg partial). - 1 of 4 bug tests PASSES unexpectedly on current HEAD: 'Issue 19906 - named arg completion - non-overloaded method - second arg partial'. Kept as written per sprint instructions; indicates the regression is partial and only manifests for overloaded methods / optional-arg curried functions. - All 3 regression guards PASS as expected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
GetNamedParametersAndSettableFields now scans all captured name resolutions at endPos (not just the head) for an Item.CtorGroup/Item.MethodGroup, and falls back to sResolutions.CapturedMethodGroupResolutions when a trailing partial named arg refines/shadows the original group on the captured-name-resolutions side. For undecided overloads where neither store has a usable resolution at endPos, an additional parse-tree-based recovery resolves the call target through ResolveLongIdentAsExprAndComputeRange off the typecheck path (TcResultsSink.NoSink, no sink pollution). Also harmonizes the None branch of the named-arg dispatch in GetDeclarationListInfo to return the already-filtered/tagged items rather than the raw ones. This fixes 6 of the 7 RED-phase tests. The 7th test (optional args - second arg partial) exercises 'let f (?x:int) (?y:int) (?z:int) = ()' which is invalid F# (FS0718 - optional arguments are only permitted on type members). The compiler produces no MethodGroup/CtorGroup resolution for such a binding, so no production-side fix in FSharpCheckerResults.fs can recover its named arg list. Per the sprint's escape-hatch instructions, a TODO #19906 marker has been left in the source and the test (and its parse-tree fallback path) is deferred to a follow-up sprint. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds release-notes entry for the named-arg completion fix and applies
fantomas formatting to the touched files.
Test adjustment: 'Issue 19906 - named arg completion - optional args -
second arg partial' originally used 'let f (?x:int) (?y:int) (?z:int) = ()'
which is invalid F# (FS0718 - optional arguments are member-only). The
compiler produces no MethodGroup/CtorGroup resolution for such a binding,
so the previous-sprint commit explicitly deferred it. The test is now
rewritten to use a member method with optional args (valid F#), exercising
the same code path through the production fix. No production code change.
Unrelated baseline failures observed in Service.Tests Release (12/4470),
all in NuGet/Type Provider areas and independent of completion code:
ScriptOptionsTests.can resolve nuget packages to right target framework
for different frameworks regardless of execution environment (4)
ProjectAnalysisTests.Test Project25 (symbol uses / whole project errors) (7)
MultiProjectAnalysisTests+GenerativeTypeProviderFallbackTest (1)
SurfaceArea tests pass; all CompletionTests (169/169) pass.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Drop dead CapturedMethodGroupResolutions fallback (GetCapturedNameResolutions already filters the same store) - Extract shared ParsedInput.tryGetCallTargetAndArg helper so the parse-tree recovery no longer duplicates the six head shapes of (|NewObjectOrMethodCall|_|) - Replace mutable last-write-wins visitor with a short-circuiting SyntaxVisitorBase<LongIdent> - Drop bare catch-all around ResolveExprDotLongIdentAndComputeRange; rely on its ResultOrException return - Extract typeOfIntermediateItem helper for clarity Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
❗ Release notes requiredYou can open this PR in browser to add release notes: open in github.dev Caution No release notes found for the changed paths (see table below). Please make sure to add an entry with an informative description of the change as well as link to this pull request, issue and language suggestion if applicable. Release notes for this repository are based on Keep A Changelog format. The following format is recommended for this repository:
If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request.
|
Fixes #19906
After the first named argument is autocompleted in a method call (including
overloaded methods like
Task.Factory.StartNewand optional arguments),IntelliSense stops suggesting remaining named arguments. The captured name
resolutions at the cursor position get shadowed by refined single-overload
items; this fix scans all resolutions and, when none match, recovers the
call target from the parse tree.