cm.getModeAt(pos) stability

getTokenAt will re-run the tokenizer for at least the line you’re looking at. If it keeps returning different values that suggests the tokenizer might be broken (they should usually be deterministic).