relay
relay copied to clipboard
[relay-lsp] Add a refactor to turn global variable into explicit fragment argument
Might be more correct to say "turn a global variable reference into an explicit fragment argument".
I'm imagining it would turn this:
fragment UserProfile_fragment on User {
name
profile_picture {
url(scale: $scale) # <-- Right click here to refactor...
}
}
query($scale: Float!) {
me {
...UserProfile_fragment
}
}
Into:
fragment UserProfile_fragment on User @argumentDefinitions(
scale: {type: "Float"} # <-- Maybe you could even have the ability to specify this as a new local name?
) {
name
profile_picture {
url(scale: $scale)
}
}
query($scale: Float!) {
me {
...UserProfile_fragment @arguments(scale: $scale)
}
}