According to lang-xml github, xml language supports self closing tag by typing /. But, it’s currently not closing the tag automatically.
Example, if I typed:
<field /
It does not automatically provide the closing tag. But, If I typed:
<field>
It will automatically add the proper closing tag like so:
<field></field>
Any idea why self-closing tag is not working?
Here’s my code:
const state = EditorState.create({
doc: initialDoc,
extensions: [
basicSetup,
indentUnit.of(' '),
keymap.of([indentWithTab]),
indentationMarkers(),
themeCompartment.of(codeMirrorService.getTheme(config.theme)),
xml(),
autoCloseTags,
fontFamilyCompartment.current.of(getFontFamily()),
fontSizeCompartment.current.of(getFontSize()),
EditorView.updateListener.of((update) => {
if (update.docChanged && onChange) {
onChange && onChange(update.state);
}
}),
],
});
const view = new EditorView({
state,
parent: refContainer.current,
});