-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CodeComplete] Complete argument labels after vararg #36814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci Please test |
test/IDE/complete_call_arg.swift
Outdated
value.test("test", xArg: #^COMPLETE_AFTER_VARARG^#) | ||
// COMPLETE_AFTER_VARARG: Begin completions | ||
// COMPLETE_AFTER_VARARG-DAG: Pattern/ExprSpecific: {#yArg: Foo...#}[#Foo#]; | ||
// COMPLETE_AFTER_VARARG-DAG: Pattern/ExprSpecific: {#zArg: Foo...#}[#Foo#]; | ||
// COMPLETE_AFTER_VARARG: End completions | ||
value.test("test", xArg: #^COMPLETE_AFTER_VARARG_WITH_PREV_PARAM^#) | ||
// COMPLETE_AFTER_VARARG_WITH_PREV_PARAM: Begin completions | ||
// COMPLETE_AFTER_VARARG_WITH_PREV_PARAM-DAG: Pattern/ExprSpecific: {#yArg: Foo...#}[#Foo#]; | ||
// COMPLETE_AFTER_VARARG_WITH_PREV_PARAM-DAG: Pattern/ExprSpecific: {#zArg: Foo...#}[#Foo#]; | ||
// COMPLETE_AFTER_VARARG_WITH_PREV_PARAM: End completions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests don't look right. For xArg: #^HERE^#
, expected suggestion are global expression completions, but not argument labels.
xArg: #^COMPLETE_AFTER_VARARG_WITH_PREV_PARAM^#
is currently the same as COMPLETE_AFTER_VARARG
. This probably meant xArg: .bar, #^HERE^#
which expects argument labels and global expressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course 🤦 Updated the tests to test the right thing and the PR to behave according to the updated tests.
Currently, if the code completion token is after a label that refers to a vararg, it is part of that VarargExpansionExpr, so we don’t suggest the subsequent parameter’s label. Add special handling to detect this situation and suggest the parameter label. Fixes rdar://76355192
242d7e2
to
7e536ff
Compare
@swift-ci Please test |
Build failed |
@swift-ci Please smoke test macOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Currently, if the code completion token is after a label that refers to a vararg, it is part of that
VarargExpansionExpr
, so we don’t suggest the subsequent parameter’s label.Add special handling to detect this situation and suggest the parameter label.
Fixes rdar://76355192