Skip to content

[Repo Assist] fix: raise named-argument completion priority to match Property (closes #1500)#1503

Merged
Krzysztof-Cieslak merged 2 commits intomainfrom
repo-assist/fix-issue-1500-constructor-arg-completion-priority-7350780ac29ed777
Mar 18, 2026
Merged

[Repo Assist] fix: raise named-argument completion priority to match Property (closes #1500)#1503
Krzysztof-Cieslak merged 2 commits intomainfrom
repo-assist/fix-issue-1500-constructor-arg-completion-priority-7350780ac29ed777

Conversation

@github-actions
Copy link
Contributor

🤖 This is an automated PR from Repo Assist.

Closes #1500

Root Cause

In ParseAndCheckResults.fs, the getKindPriority sort function assigned CompletionItemKind.Argument a priority of 5 — lower than Property (1), Field (2), Method (3), and Event (4):

| CompletionItemKind.Argument -> 5   // was below everything else

When FCS returns named arguments for constructor/function call completion (e.g. Person(Name = ...)), these items have kind Argument. Since they sorted after all properties and methods, they appeared far down the completion list rather than at the top.

Fix

Raise Argument priority to 1 (equal to Property), so named arguments appear at the top of the completion list alongside the type's own properties:

| CompletionItemKind.Argument -> 1   // now equal to Property
| CompletionItemKind.Property -> 1

This is consistent with user expectations: in a constructor/function call context, the named parameters of the current call are the most immediately relevant completions.

Trade-offs

  • Named arguments will now tie with Property in the sort, with alphabetical order breaking ties. This is an improvement — constructor parameters deserve at least the same visibility as properties.
  • The change applies globally (not just in constructor context), which is the right behaviour: named function arguments should also sort to the top when present.

Test Status

Build: ✅ dotnet build src/FsAutoComplete.Core/FsAutoComplete.Core.fsproj -c Release — 0 warnings, 0 errors.
Format: ✅ dotnet fantomas — file unchanged.

Generated by Repo Assist

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

Named arguments in constructor and function call contexts (CompletionItemKind.Argument)
were assigned sort priority 5, placing them below Properties (1), Fields (2), Methods (3),
and Events (4). This meant that when triggering completion inside e.g. Person(Name = ...),
the named parameters Age and Name appeared far down the list.

Raise Argument priority to 1 (same as Property) so named arguments appear at the top
of the completion list alongside the type's own properties.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@goswinr
Copy link
Contributor

goswinr commented Mar 13, 2026

LGTM

@goswinr
Copy link
Contributor

goswinr commented Mar 18, 2026

this works:
image

@Krzysztof-Cieslak Krzysztof-Cieslak marked this pull request as ready for review March 18, 2026 12:00
@Krzysztof-Cieslak Krzysztof-Cieslak merged commit 2524a8d into main Mar 18, 2026
18 of 19 checks passed
@Krzysztof-Cieslak
Copy link
Member

@goswinr Thanks for testing it❤️

github-actions bot added a commit that referenced this pull request Mar 18, 2026
…ate to 2026-03-18

Adds two user-facing fixes merged after the initial v0.84.0 changelog was written:
- #1503: Fix named-argument completion priority
- #1504: Fix hover documentation for FSI hash directives

Also updates the release date to 2026-03-18.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show properties at top of list in type constructor

2 participants