[Repo Assist] fix: raise named-argument completion priority to match Property (closes #1500)#1503
Draft
github-actions[bot] wants to merge 2 commits intomainfrom
Conversation
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>
18 tasks
Contributor
|
LGTM |
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.
🤖 This is an automated PR from Repo Assist.
Closes #1500
Root Cause
In
ParseAndCheckResults.fs, thegetKindPrioritysort function assignedCompletionItemKind.Argumenta priority of 5 — lower thanProperty(1),Field(2),Method(3), andEvent(4):When FCS returns named arguments for constructor/function call completion (e.g.
Person(Name = ...)), these items have kindArgument. Since they sorted after all properties and methods, they appeared far down the completion list rather than at the top.Fix
Raise
Argumentpriority to 1 (equal toProperty), so named arguments appear at the top of the completion list alongside the type's own properties: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
Propertyin the sort, with alphabetical order breaking ties. This is an improvement — constructor parameters deserve at least the same visibility as properties.Test Status
Build: ✅
dotnet build src/FsAutoComplete.Core/FsAutoComplete.Core.fsproj -c Release— 0 warnings, 0 errors.Format: ✅
dotnet fantomas— file unchanged.