Skip to content

Commit

Permalink
support property access
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed May 27, 2024
1 parent f700878 commit 9bea213
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/lemon-papayas-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@0no-co/graphqlsp': patch
---

Support property-access-chain in binary-expression assignment
6 changes: 5 additions & 1 deletion packages/graphqlsp/src/ast/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ function unrollFragment(
} else if (ts.isPropertyAssignment(found.parent)) {
found = found.parent.initializer;
} else if (ts.isBinaryExpression(found.parent)) {
found = found.parent.right;
if (ts.isPropertyAccessExpression(found.parent.right)) {
found = found.parent.right.name as ts.Identifier;
} else {
found = found.parent.right;
}
}

// If we found another identifier, we repeat trying to find the original
Expand Down

0 comments on commit 9bea213

Please sign in to comment.