How do I get the lineNumber from the char at index x

Hey!

This is my last question to codemirror V6 - promise.
I think you could use something like a editor.posAtIndex(index) to get the line, the char is at.
Now in CM v6 I have my view instance of the editor, but can´t find a function similar to this, except for “wordAt(index)”.

So how do I highlight a complete line, where the charAt(index) is?

Any ideas?

You can get information about a line around a given position with state.doc.lineAt(pos). The result holds the start of the line, the end, and the line number.

1 Like

Awesome, that worked, thanks you so much!