Skip to content

Commit

Permalink
Fix argument Inlay Hints on nested fields (#4739)
Browse files Browse the repository at this point in the history
Summary:
Previously the selections of linked fields weren't visited, so arguments on those selections didn't have inlay hints.

|Before|After|
|---|---|
|![CleanShot 2024-07-13 at 16 25 16@2x](https://github.com/user-attachments/assets/9afc9fc3-9af5-4da2-8dfb-5383c0f8956d)|![CleanShot 2024-07-13 at 16 24 29@2x](https://github.com/user-attachments/assets/ef9358b7-9f68-4ef3-aa99-0dd180a12fd9)|

Pull Request resolved: #4739

Reviewed By: tyao1

Differential Revision: D60604784

Pulled By: captbaritone

fbshipit-source-id: f0eafb487f5eb5d8c0ded3d66e44266dfed6d8dc
  • Loading branch information
tobias-tengler authored and facebook-github-bot committed Aug 5, 2024
1 parent 70392c7 commit c3e2b96
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions compiler/crates/relay-lsp/src/inlay_hints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ impl Visitor for InlayHintVisitor<'_> {

fn visit_linked_field(&mut self, field: &graphql_ir::LinkedField) {
let field_def = self.schema.field(field.definition.item);
self.add_field_argument_hints(field_def, &field.arguments)
self.add_field_argument_hints(field_def, &field.arguments);

self.default_visit_linked_field(field);
}

fn visit_fragment_spread(&mut self, spread: &FragmentSpread) {
Expand All @@ -163,7 +165,9 @@ impl Visitor for InlayHintVisitor<'_> {

fn visit_inline_fragment(&mut self, fragment: &InlineFragment) {
if let Ok(Some(alias)) = fragment.alias(self.schema) {
self.add_alias_hint(alias.item, fragment.spread_location)
self.add_alias_hint(alias.item, fragment.spread_location);
}

self.default_visit_inline_fragment(fragment)
}
}

0 comments on commit c3e2b96

Please sign in to comment.