Hi, I am using CM and i’m looking to extract certain terms from the code, almost all terms work great, the rest is a bit challenging:
float numbers is an issue, i’m using findWordAt()
that parses the terms so for example the number 1.23 would be parsed as either 1, or “.” or 23, but never as a float.
Since i’m using “mode” in Python mode, I’ve noticed that CM actually does find numbers and gives them the cm-number
class, so my question is how or what method should I use to capture cm-number
as a “whole float” returned?
I currently use a mousedown event in parallel with CM’s cursorActivity
to capture the number as follows:
$('#element').on('mousedown', function (event) {
try {
cm_object_isNumber($(event.target).closest(".cm-number")[0].textContent)
}catch (e) {
console.log(`error: ${e}`);
}
});
I would rather use CM for all these CM text operations since scaling up the project, I predict this will break or become a monstrosity.
Thanks