eclipse.platform.ui icon indicating copy to clipboard operation
eclipse.platform.ui copied to clipboard

Maven "pom.xml": popup for validation warning has wrong size

Open WolfgangHG opened this issue 8 months ago • 3 comments

I created a maven project from the archetype "org.wildfly.archetype:wildfly-jakartaee-webapp-archetype:35.0.1.Final", then I added three dependencies to pom.xml:

<dependency>
	<groupId>jakarta.servlet.jsp</groupId>
	<artifactId>jakarta.servlet.jsp-api</artifactId>
	<scope>provided</scope>
</dependency>

<dependency>
	<groupId>org.glassfish.web</groupId>
	<artifactId>jakarta.servlet.jsp.jstl</artifactId>
	<version>3.0.1</version>
	<scope>provided</scope>
</dependency>

<dependency>
	<groupId>jakarta.servlet.jsp.jstl</groupId>
	<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
	<version>3.0.1</version>
	<scope>provided</scope>
</dependency>

One dependency has a unnecessary "version" element. So a warning "Overriding managed version 3.0.2 for jakarta.servlet.jsp.jstl-api" is reported. The popuop when hovering over the warning text has a wrong size.

When hovering over "version", the message is completely visible, but when resizing the popup, additional info about the "version" element becomes visible. Is this intended? Image

When hovering over the text content of "version", the message is clipped. A second warning is shown when resizing it:

Image

Hope this the right place to report it. Some time ago I reported a similar "popup is too small" problem for the xml editor (https://www.github.com/eclipse-lsp4e/lsp4e/issues/214) and was told to report it here. But as I could not reproduce the issue, I did not do this ;-). Anyway, in the other issue it was suggested that it might be related to multiple warnings in one place, and the second warning could be such a case, as there are two messages.

WolfgangHG avatar Apr 13 '25 19:04 WolfgangHG

I know from experience that getting the hover to be a nice size is a challenge at best. The framework just doesn't do such a great job supporting this. It depends on calls to org.eclipse.jface.text.AbstractInformationControl.setSizeConstraints(int, int) which gets info from org.eclipse.jface.internal.text.InformationControlReplacer.computeBoundsFromContent(IInformationControl, Rectangle) where things heavily depend on how the HTML is converted to text for which the size can be properly computed. Unfortunately I doubt anyone is going to fix this generic problem without the involvement of the framework that is producing this information.

It is possible to product larger results by investing more effort on the production side of things as we do for the hovers in Oomph setup editor:

Image

merks avatar Apr 14 '25 05:04 merks

Indeed, the issue is most likely caused by setSizeConstraints not receiving the right value. For this particular case in the description, the popup is a Composite of the usual error hover popup and a web browser showing the description (see CompositeInformationControl and CompositeInformationControlCreator). For the tests in org.eclipse.ui.genericeditor.tests, it should be possible to debug whether 2 "compound" hover do receive the right setSizeConstraint or similar. But IIRC (I'm not sure), the issue doesn't happen with "static" hover content, but happens very easily if the 2nd hover element is a Browser (like it's the case in the initial description).

Anyway, there is nothing easy to do here, except running a debugger on the CompositeInformationControl and family.

mickaelistria avatar Apr 14 '25 07:04 mickaelistria

Unfortunately I doubt anyone is going to fix this generic problem without the involvement of the framework that is producing this information.

and

Anyway, there is nothing easy to do here, except running a debugger on the CompositeInformationControl and family.

I cannot help with debugging, being no Eclipse developer ;-).

Your comment sounds like the project which creates the message would have to handle this? So a new issue somewhere else?

WolfgangHG avatar Apr 15 '25 18:04 WolfgangHG

I added a PR #3056 for this. Please review.

ghentschke avatar Jun 20 '25 08:06 ghentschke

@ghentschke Many thanks for the fix! I can confirm that it is much, much better now! If you are still willing to work on this: I found a edge case where alignment is still broken, see #3505.

WolfgangHG avatar Nov 05 '25 20:11 WolfgangHG