Search code examples
eclipsemavenpom.xmlspring-tool-suiteautoformatting

Eclipse STS will not format pom.xml


I'm in a freshly installed Spring STS 4.18.0 (latest) and I can't autoformat a pom file.

  • the Eclipse menu Source/Format is disabled for any pom.xml
  • the editor context menu Source/Format is disabled for any pom.xml
  • Ctrl-Shift-F does nothing in a pom.xml (the key mapping is there, I checked)
  • in Package Explorer right-click menu Source/Format is active and also works fine
  • there are no errors in Eclipse error log
  • everything is updated successfully to the latest
  • when I open just any other XML file, everything works fine.

So there's something wrong with the POM editing and I'm used to the keyboard shortcut... any idea what should I check to make it work? I've seen a similar older question but it doesn't give any solution.


Solution

  • The related issue from the STS4 issue tracker: https://github.com/spring-projects/sts4/issues/1010

    The underlying problem is a regression in the lps4e project that is used to connect the language servers (in this case the XML and m2e extension for the XML language server). The fix is already implemented via https://github.com/eclipse/lsp4e/pull/571 and will ship as part of the next STS4 release for sure. Once the PR is merged and a snapshot build of lsp4e is available, you can try to install that latest snapshot to get the fix early.