Autocompletion after <space> ?

Sorry, not sure exactly how to describe this.

(with my own lang/parser)

When I type

and have this running:

  let nodeBefore = syntaxTree(context.state).resolveInner(context.pos, -1)

  console.log(nodeBefore.parent?.parent?.name , nodeBefore.parent?.name, )

I get: undefined undefined RulesText (basically, @top)

If I type one more letter, it figures out I’m in a statement, and the parent is what I expect/want.

RulesText Action ⚠

I’d love to be able to start autocompletion without typing that next letter.
Is that possible? Did I do something weird in my grammar?
I tried all the variations of resolve{Inner} that I could think of.

I’m probably just misunderstanding how this should be done.

You will have a tree like RulesText(Rule(Identifier, ⚠️)), I assume, but the Rule only spans the identifier, not the space, so if you resolve the position after that, that won’t put you inside of it. The enterUnfinishedNodesBefore utility method might be useful here.

1 Like

Thanks! I kept reading past enterUnfinishedNodesBefore. Got something going now.