Equivalent of findWordAt in CM6 ?

Hi! Is there any equivalent to the findWordAt method in CM6? I’d be interested in finding a way to detect the current word on the cursor. From the docs, I see that maybe I could use one of the commands, e.g. selectGroupRight or selectGroupLeft (at least if my understanding of what is a group is right), but I don’t know how to use them if that’s the case. Any tips or advice?

1 Like

The search addon has one internally, but I agree it’d make sense to put that someone where client code can use it. Will look into this next week.

1 Like

@codemirror/state 0.18.6 now comes with an EditorState.wordAt(pos: number) => SelectionRange | null method.

2 Likes