Mirror: TypeScript LSP plugin that finds GraphQL documents in your code and provides diagnostics, auto-complete and hover-information.

chore(core): support property access (#324)

Changed files
+10 -1
.changeset
packages
graphqlsp
src
ast
+5
.changeset/lemon-papayas-brush.md
···
+
---
+
'@0no-co/graphqlsp': patch
+
---
+
+
Support property-access-chain in binary-expression assignment
+5 -1
packages/graphqlsp/src/ast/index.ts
···
} 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