-
Notifications
You must be signed in to change notification settings - Fork 325
Description
Description
Hello, im hoping for inlay hints to be shown for trailing closures. I often have trouble working out what parameter the trailing closure is for - and an inlay hint would be a great way to help me out here. I'm sure other beginners learning swift would also appreciate this feature.
An example (from Apples' NavigationCookBook example project):
.sheet(isPresented: $navigationModel.showExperiencePicker) {
ExperiencePicker(experience: $experience)
}The function signature for .sheet is
func sheet<Content>(
isPresented: Binding<Bool>,
onDismiss: (() -> Void)? = nil,
@ViewBuilder content: @escaping () -> Content
) -> some View where Content : ViewIts not immediately clear to a beginner whether the trailing closure relates to onDismiss or content.
The enhancement here would be to add an inlay hint as follows:
.sheet(isPresented: $navigationModel.showExperiencePicker) : content {
ExperiencePicker(experience: $experience)
}Those proficient with swift may find inlay hints here unnecessarily verbose - and that is why i'm proposing this be an optional toggle feature (consistent with how other LSPs allow granular control over what type of inlay hints are shown and which ones are not)
Thank you for your consideration.