What’s the best way to ascertain which line of the document is being processed by the token
method for an overlayMode?
The best I’ve achieved so far has been to use startState
to create an object with a lines
prop to track the line count. Then, using the token
method in-conjunction with a blankLines
method I increment the line count each time I hit the end of the line in the stream.
Additionally, I want to add / remove widgets once the whole doc/stream has finished being parsed or during the parse. These widgets are buttons which open a popup - much like you’d have when spell checking in a word processor for example, or refactoring in an IDE.
I’m finding that my widgets added via cm.addWidget(pos, node, false);
are being positioned at left:0px
even if pos.ch
is say 20
. The vertical / top
position is correct. I tested the pos value using cm.doc.setCursor(pos)
and the cursor is positioned correctly.
Should the widget be positioned at the char rather the start of the line? Is there another mechanism for hanging nodes at a given position?