-
Notifications
You must be signed in to change notification settings - Fork 55
Specify Types: support named patterns and members #849
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
03963a4
to
8ef21c3
Compare
let inline (?>) (x: 'a) ([<InlineIfLambda>] f: 'a -> 'b) = | ||
if isNull x then null else f x |
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.
Should we maybe do it in a separate PR and use it in more cases right away?
@@ -208,28 +226,54 @@ module SpecifyTypes = | |||
|
|||
| _ -> () | |||
|
|||
module SpecifyTypesActionHelper = | |||
open SpecifyTypes | |||
let executePsiTransaction (node: ITreeNode) (availability: Availability) = |
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.
Please add new lines.
specifyParameterTypes types (fun x -> x[0].Type) enumerate parameters true | ||
else | ||
let types = getFunctionTypeArgs true mfv.FullType | ||
specifyParameterTypes types id (_.GenericArguments) parameters 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.
Are the parens required 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.
We are currently using .NET 8.0.100 for GitHub Actions, which doesn't support shorthand syntax without parens properly.
We can upgrade it slightly in a separate PR or leave the brackets 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.
Let's upgrade it then! :)
inherit FSharpContextActionBase(dataProvider) | ||
|
||
override x.Text = "Add type annotations" | ||
abstract member IsAvailable: 'a -> bool | ||
member x.ContextNode = dataProvider.GetSelectedElement<'a>() |
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.
Please add new lines.
override x.IsAvailable(_: IUserDataHolder) = | ||
let node = x.ContextNode | ||
|
||
isNotNull node && isValid (node :> ITreeNode) && |
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.
Are both isValid
and isNotNull
checks needed here? Doesn't the first one include the second? Also why is the cast needed?
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.
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.
Oh, wow. That's really unfortunate :(
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.
This is really good, thank you!
^ Conflicts: ^ ReSharper.FSharp/src/FSharp/FSharp.Psi.Intentions/src/Intentions/FunctionAnnotationAction.fs
7d82751
to
fb8fe3d
Compare
Additional entry point for
specify types
via context actions. Currently supported the same scenarios as for inlay hints materialization.The following PR's will add support for primary constructors / properties with accessors, etc