Typed a space , the result of 'resolveInner' does not match the expectation

I am developing my DSL code complement based on codemirror6.

When I typed a colon after the word layout, I get a list of options for ‘horizontal’, ‘vertical’, which is correct

object [1:0..1:20]
 └─ DefineStatement [1:0..1:20]
     ├─ VariableDefine [1:0..1:1]: "a"
     ├─ ASSIGN [1:1..1:2]: "="
     ├─ Boolean [1:2..1:6]: "true"
     ├─ . [1:6..1:7]: "."
     └─ f_show [1:7..1:20]
         ├─ show [1:7..1:11]: "show"
         ├─ ( [1:11..1:12]: "("
         ├─ layout [1:12..1:18]: "layout"
         ├─ : [1:18..1:19]: ":"
         ├─ ? 1:19
         └─ ) [1:19..1:20]: ")"

But if I enter a space after :, it doesn’t work right.

I used resolveInner to get the node at the current cursor position

let inner = tree.resolveInner(context.pos, -1)

In the absence of a space, the inner node is “:”, but if there is a space, it changes to “f_show”
I want to be able to get the node “:” or the error node even if I typed a space
I tried enterUnfinishedNodesBefore, but the output also did not meet expectations

let tree : Tree = syntaxTree(context.state)
// log => object
let inner = tree.resolveInner(context.pos, -1)
// log => f_show

It should be that I’m not using it in the right way, how can I fix it?

resolve and resolveInner will only enter nodes that directly touch the given position. You may be able to use childBefore to move from the f_show node to the node you are looking for.

thanks for your help , I tried childBefore, the problem is solved