lemminx icon indicating copy to clipboard operation
lemminx copied to clipboard

Completion when changing a tag inserts wrong closing tag

Open felixfbecker opened this issue 7 years ago • 10 comments

2018-09-14 13 07 37

The tag already has a closing tag, and I am within a starting tag, so it should insert one.

felixfbecker avatar Sep 14 '18 11:09 felixfbecker

@felixfbecker I don't understand how you do that with vscode: you select a tag name and you type some content and it updates the end tag too?

Could you explain me please?

Please note that you have a rename feature which supports that.

angelozerr avatar Sep 14 '18 11:09 angelozerr

Perhaps its' an extension that you have installed?

angelozerr avatar Sep 14 '18 11:09 angelozerr

Oh, that's a different extension: https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-rename-tag

It should not affect the bug because the autocompletion is provided by vscode-xml.

I use that extension because in JSX, when you rename an element, it will rename the referenced component (everywhere), not change which component is referenced. The equivalent in vscode-xml would be if it changed the name attribute for the xs:element is the referenced XSD. So I just trained myself to not use rename for this.

felixfbecker avatar Sep 14 '18 11:09 felixfbecker

lsp4xml gives the capability ro rename the start/end tag element (not the whole document).

I will try to install your extension and play with it. I don't know if it's an hard task to do.

angelozerr avatar Sep 14 '18 11:09 angelozerr

To be entirely clear: This bug has nothing to do with the extension. It happens without the extension too.

2018-09-14 13 40 49

felixfbecker avatar Sep 14 '18 11:09 felixfbecker

I understand your problem and it should be cool to fix it, but I think it's an hard task because in your case you need to detect that </ListItem> is an end element which have no opened element and which be replaced with the opened <TableColumnItem>.

Today the tolerant XML parser ignore the end element which have no opened element (it's the same logic than the HTML Language Server of vscode).

I keep opened this issue, but I don't know when (and if) it will be fixed. Changing the XML parser (which is a translate of HTML Language Server of vscode) scares me. Any contribution are welcome!

angelozerr avatar Sep 14 '18 11:09 angelozerr

Awesome. If rename works, there are definitely more important priorities like #117, https://github.com/redhat-developer/vscode-xml/issues/17

felixfbecker avatar Sep 14 '18 11:09 felixfbecker

Awesome.

Glad it pleases you:) The only think with rename is that you have not completion.

If rename works, there are definitely more important priorities like #117, redhat-developer/vscode-xml#17

I have an idea how to do fix it, just find time to do it:)

angelozerr avatar Sep 14 '18 12:09 angelozerr

@felixfbecker I'm not sure, but perhaps the future settings autoCloseTags in https://github.com/angelozerr/lsp4xml/issues/130 could fix your problem.

angelozerr avatar Sep 21 '18 11:09 angelozerr

Yeah, I think I would prefer tags to not be autoclosed, since it's easy to manually close a tag by invoking autocompletion and selecting the suggestion to close the tag.

felixfbecker avatar Sep 21 '18 11:09 felixfbecker