There were many discussions about this in the past (e. g. here or here and also a PR which was merged without this feature done long time ago) but actually I didn't really find something related to Code Mirror 6...so if this isn't a restriction to CM6, it could be worth a feature request...
In the meantime, as a workaround, maybe take a look at this post: