-
Notifications
You must be signed in to change notification settings - Fork 288
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
Don’t offer text edits from inlay hints if they are syntactically invalid #770
Conversation
@swift-ci Please test |
|
||
self.range = startIndex..<endIndex | ||
self.printedType = printedType | ||
self.hasExplicitType = hasExplicitType | ||
self.canBeFollowedByTypeAnnotation = tokenAtOffset?.canBeFollowedByTypeAnnotation ?? true |
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.
Would a false
default be better here?
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.
Not really. canBeFollowedByTypeAnnotation
is a blacklist-based method that also defaults to true
. That’s why I think we should also default to true
here for consistency.
var node = Syntax(self) | ||
LOOP: while let parent = node.parent { | ||
switch parent.kind { | ||
case .caseItem, .closureParam: |
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.
I was going to ask if this handles the case that the param is in ()
. But apparently it does, because closureParam
is only the non-signature case. x in
is a ClosureParamListSyntax
where as (x) in
is a ClosureParameterClauseSyntax
. The former has ClosureParam
s and the latter ClosureParameter
s 😅.
Not something that needs fixing here, but worth knowing. I don't have a great name for the former case 🤔.
…alid Don’t offer any text edits for inlay hints displayed in closure paramters or enum case items. Fixes swiftlang#759 rdar://111559715
af150a3
to
6c99034
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
Don’t offer any text edits for inlay hints displayed in closure paramters or enum case items.
Fixes #759
rdar://111559715