10

The maven POM editor in the 2021-12 release seems to have changed (new syntax coloring).

E.g. Ctrl + Shift + C and Ctrl + Shift + F don't work anymore, which used to work, and are still working when I open the pom.xml with the default XML editor in Eclipse.

Package "Eclipse IDE for Enterprise Java and Web Developers", Windows 64-bit.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Reto Höhener
  • 5,419
  • 4
  • 39
  • 79
  • 2
    I can reproduce Ctrl+Shift+C, but Ctrl+Shift+F works for me. See https://github.com/eclipse-m2e/m2e-core/issues/458#issuecomment-996032947 Please consider to provide a patch for that. – howlger Dec 20 '21 at 09:17
  • Thanks for the issue link. The reporter mentions that he cannot format, either. – Reto Höhener Dec 20 '21 at 09:22
  • 2
    Ctrl+Shift+F and right-click + _Source > Format_ works for me: indention will be corrected and in e.g. `` a line break will be added. Be aware, that the [LemMinX](https://github.com/eclipse/lemminx) formatter differs from the formatter of the WTP XML editor (m2e uses now [LemMinX-Maven](https://github.com/eclipse/lemminx-maven/) which extends LemMinX). No separate issues and the umbrella issue lacks a reproducible example (did you try it with a fresh workspace and with an installation without additional plugins?; how many different `pom.xml` files did you tested?). – howlger Dec 20 '21 at 10:16
  • 1
    Which IDE package do you have? Maybe it's an _Eclipse IDE for Java Developers_ thing, since in the _Eclipse IDE for Enterprise Java and Web Developers_ Ctrl+Shift+F works for me. – howlger Dec 20 '21 at 10:22
  • I have not tried with a fresh workspace. Consistent team-wide XML formatting settings is a big challenge: https://stackoverflow.com/questions/69298530/eclipse-wild-web-developer-generic-editor-how-to-share-the-language-server-xml. – Reto Höhener Dec 20 '21 at 10:36
  • If 2021-12 does not use the WTP XML editor anymore, the problem will get worse. I configured my eclipse now to open pom.xml files by default with the WTP XML editor for editing. But I still have to switch to the new editor for the dependency hierarchy view and the effective POM feature. And I will have to try to get awareness for this in the team. – Reto Höhener Dec 20 '21 at 10:40
  • 1
    I notice there is a "M2E Pom Editor (Legacy) using WebTools SourceEditing UI" in the "Install New Software" list, that sounds like it might be the old editor – greg-449 Dec 20 '21 at 11:13
  • @greg-449 Indeed, I see it, will check it out (convert to answer?) – Reto Höhener Dec 20 '21 at 11:17
  • @howlger I also cannot reproduce the Ctrl + Shift + F problem when creating a new maven project in a new Eclipse installation. – Reto Höhener Dec 20 '21 at 12:22
  • @RetoHöhener I shown [some of the advantages in my video](https://youtu.be/3W9bvidcO20). Please [create separate issues focusing of one thing only as requested by Mickael here](https://github.com/eclipse-m2e/m2e-core/issues/458#issuecomment-996032947) and report it to the right project: reproducible in a non-POM XML file opened in the _Generic Text Editor_ is LemMinX, reproducible in a `pom.xml` file opened in the _Generic Text Editor_ or _Maven POM Editor_ is LemMinX-Maven or m2e (when in doubt, report it to m2e). Report them as enhancements, not as bug since it's now a new XML editor. – howlger Dec 20 '21 at 12:35
  • I was not able to reproduce the formatting problem with a fresh workspace. I believe the comment toggling is a known missing feature of the Wild Web Developer generic editor for XML. I didn't realize immediately after upgrading that this is in fact the editor now used for pom files. – Reto Höhener Dec 20 '21 at 12:44
  • @RetoHöhener Does right-clicking and choosing _Source > Format_ work and which key binding is shown in the right-click menu? – howlger Dec 20 '21 at 12:50
  • I don't know what else to say, the formatting shortcut (and context menu item) works for a fresh workspace. It must be related to my existing workspace settings. Maybe I messed up some custom keyboard shortcuts, or it is related to some other plugin (I only have m2e, JFormDesigner, and decompiler). – Reto Höhener Dec 20 '21 at 12:54
  • @howlger thank you. i will also delete my corresponding comments here. – Reto Höhener Dec 20 '21 at 15:06
  • When I open the `pom.xml` file in the _Generic Text Editor_ Ctrl+Shift+C does not work (even though it's in the right-click menu in _Source_), but Ctrl+Shift+/ does work. Since Ctrl+Shift+/ does not work in the _Maven POM Editor_, I would guess m2e is missing a key binding here. So please report it to m2e as a separate issue. In the key preferences (hit Ctrl+Shift+L twice), which bindings do you have for Ctrl+Shift+F? There should be a _Format_ command for _Editing Text_ of the category _Language Servers_ and it should not be overridden by a Ctrl+Shift+F for _In Windows_. – howlger Dec 20 '21 at 15:08
  • @RetoHöhener Thx! :) – howlger Dec 20 '21 at 15:09

2 Answers2

1

I have the same problem in Eclipse 2022-03 (4.23.0) with Ctrl + Shift + C.

Instead Ctrl + Shift + F works.

Eclipse IDE for Enterprise Java and Web Developers.

1

For formatting try to enable 'Language Servers' e.g.: enter image description here

embuc
  • 465
  • 5
  • 5