Skip to content

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

Draft
github-actions[bot] wants to merge 2 commits intomainfrom
repo-assist/fix-issue-1500-constructor-arg-completion-priority-7350780ac29ed777
Draft

[Repo Assist] fix: raise named-argument completion priority to match Property (closes #1500)#1503
github-actions[bot] wants to merge 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

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

1 participant