Skip to content

[CodeCompletion] Call argument label with value placeholder #30383

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

Merged
merged 2 commits into from
Mar 13, 2020

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Mar 12, 2020

When a completion happens at a call argument position, insert label: <#T##TypeName#> instead of just label: .

rdar://problem/60379654

When a completion happens at a call argument position, insert
'label: <#T##TypeName#>' instead of just 'label: '.

rdar://problem/60379654
@rintaro
Copy link
Member Author

rintaro commented Mar 12, 2020

@swift-ci Please smoke test

@rintaro rintaro requested a review from benlangmuir March 12, 2020 18:49
Arg->getPlainType(), ContextType,
Arg->isVariadic(), Arg->isInOut(),
/*isIUO=*/false, Arg->isAutoClosure());
Builder.addTypeAnnotation("Argument");
Copy link
Member Author

@rintaro rintaro Mar 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benlangmuir I don't feel right with this. What type do you think we should use here? Maybe Arg->getParameterType() which is the type of the parameter when referenced inside the function body?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason to not use the same type as the placeholder?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really have a reason. Updated to use the same type.


testPamrameterFlags(intVal, inoutArg: &intVal, autoclosureArg: intVal, iuoArg: intVal, #^ARG_PARAMFLAG_VARIADIC^#)
// ARG_PARAMFLAG_VARIADIC: Begin completions, 1 items
// ARG_PARAMFLAG_VARIADIC-DAG: Pattern/ExprSpecific: {#variadicArg: Int...#}[#Int#];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you really don't like this. I can make it '[#Int...#]'. But I think this is OK because this specific argument itself is Int.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that Int is fine here.

@rintaro
Copy link
Member Author

rintaro commented Mar 12, 2020

@swift-ci Please smoke test

@rintaro rintaro force-pushed the ide-completion-callarg branch from cdfabd8 to 9225cfc Compare March 13, 2020 00:46
@rintaro
Copy link
Member Author

rintaro commented Mar 13, 2020

@swift-ci Please smoke test

@rintaro rintaro merged commit 52d3367 into swiftlang:master Mar 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants