Skip to content
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

Inspect - identify when position is left hand side of assignment #56

Closed
mattmasson opened this issue Sep 30, 2019 · 3 comments
Closed

Comments

@mattmasson
Copy link
Member

We shouldn't return intellisense suggestions when we're on the left hand side of an assignment (i.e. providing a variable name). Ex:

let a = 1, |
let a = 1, bin|

Ideally, the inspection result would provide a boolean flag that the intellisense code would use to determine that no suggestions should be returned in these cases.

@mattmasson
Copy link
Member Author

mattmasson commented Sep 30, 2019

@JordanBoltonMN - thoughts/suggestions on how to best implement this? Would I check if the closest node is a Constant(,), but not a parameter for an invoke expression?

Maybe there is a parser context/state that expects an identifier declaration?

@JordanBoltonMN
Copy link
Contributor

I see a few scenarios considering the inspection finds the closest leaf node to the left of the cursor, then travels upwards through its parents:

  • If you reach a GeneralizedIdentifierPairedExpression, then you must be in a RecordExpression. When in a record expression you either are or are not on the key
  • If you reach a GeneralizedIdentifierPairedAnyLiteral, then you must be in a RecordLIteral. When in a record literal you either are or are not on the key.
  • If you reach a LetExpression, then you may be in a LetExpression. First check if the parent is a LetExpression, then check if you are either are or are not on the key.

@JordanBoltonMN
Copy link
Contributor

Resolved in #70 and #76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants