determine line number when my codemirror mode object is called

368 views Asked by At

My codemirror mode object implements token(stream, state) and blankLine(state) methods.

How do I determine the line number of the stream object that is passed in to token method, and the line number that was skipped when my blankLine was called?

1

There are 1 answers

0
Marijn On BEST ANSWER

You can't, and you shouldn't. Modes must approach the document as a stream, and only know about what came before (the state) and the current line (the stream). This is necessary to allow the editor to use highlighting info and states even if lines were added or removed above a given position in the document.