Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting selection fails with root element with mixed content #1414

Closed
JessicaJHee opened this issue Dec 15, 2022 · 0 comments · Fixed by #1416
Closed

Formatting selection fails with root element with mixed content #1414

JessicaJHee opened this issue Dec 15, 2022 · 0 comments · Fixed by #1416
Labels
bug Something isn't working
Milestone

Comments

@JessicaJHee
Copy link
Contributor

Given this XML:

<a>
    zz    <b>  </b>tt     </a>

If the whole XML is selected, the following NPR is generated;

[Error - 4:24:13 PM] Dec 15, 2022 04:24:13 org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError()
Message: Internal error: java.lang.NullPointerException: Cannot invoke "org.eclipse.lemminx.dom.DOMElement.getStartTagCloseOffset()" because the return value of "org.eclipse.lemminx.dom.DOMElement.getParentElement()" is null
java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "org.eclipse.lemminx.dom.DOMElement.getStartTagCloseOffset()" because the return value of "org.eclipse.lemminx.dom.DOMElement.getParentElement()" is null
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:649)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

This is caused by: https://github.com/eclipse/lemminx/blob/e5bfd0af4f2021f54cd3c2fc0b23ee8c36b13b47/o[…]va/org/eclipse/lemminx/services/format/DOMElementFormatter.java

@JessicaJHee JessicaJHee added the bug Something isn't working label Dec 15, 2022
datho7561 added a commit to datho7561/lemminx that referenced this issue Dec 16, 2022
@datho7561 datho7561 moved this to 👀 In review in IDE Cloudaptors Dec 16, 2022
@datho7561 datho7561 added this to the 0.24.0 milestone Dec 16, 2022
datho7561 added a commit that referenced this issue Dec 16, 2022
Repository owner moved this from 👀 In review to ✅ Done in IDE Cloudaptors Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants