How to automatically complete the html tag when Codemirror presses the Tab key?

for example, enter

div

then press the tab key at the cursor, and the auto-completion is

.
<div></div>

how can it be implemented?


Zen code (Emmet) haven't seen it? There are many implementations of each editor, and the source code is not difficult to find. The principle is to automatically match the rules according to a few characters before the cursor position

Menu