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

Suppress resolution if 'Configure problem severity' is the only available options #1614

Open
nburnwal09 opened this issue Feb 13, 2025 · 4 comments · May be fixed by #1615
Open

Suppress resolution if 'Configure problem severity' is the only available options #1614

nburnwal09 opened this issue Feb 13, 2025 · 4 comments · May be fixed by #1615

Comments

@nburnwal09
Copy link

Currently, the context menu option "Quick fix" is visible for problems where no fix is available, which then leads to a pop-up menu saying No fixes available.
There are many such issues for this condition. Attaching a sample here for the issue - a space added after the header name before the ':'.

Image

Steps to reproduce:

  1. Introduce a minor issue in the code, such as adding an extra space after the header name before the ':'.
  2. Right-click on the problem in the Problems view.
  3. Select the "Quick fix" context menu option.
  4. Observe the pop-up menu indicating 'No fixes available.'

This behaviour misleads developers into thinking that a quick fix is available for the problem. After clicking the 'Quick fix' context menu option, it states 'No fixes available,' which can waste developers' time and cause frustration.

To avoid this misleading, one solution could be to disable the context menu option 'Quick fix' where no fixes are available like this:

Image

@nburnwal09 nburnwal09 changed the title Proposal to disable quick fixes for 'No fixes available' ones Disable the context menu option Quick fix for 'No fixes available' ones Feb 13, 2025
@laeubi
Copy link
Contributor

laeubi commented Feb 13, 2025

The QuickFix menu is provided by platform, not by PDE. Beside that the main problem is that computing Quickfixes can be an expensive task so disable the menu item might not be possible without performance issues when opening the menu.

@nburnwal09
Copy link
Author

nburnwal09 commented Feb 13, 2025

Upon right click on the problem to get the context menu pop-up, the code passes through this function in PDE (before the context menu pop-up is showed)

int getProblemId(IMarker marker) {
int problemID = marker.getAttribute(PDEMarkerFactory.PROBLEM_ID, PDEMarkerFactory.NO_RESOLUTION);
if (problemID != PDEMarkerFactory.NO_RESOLUTION) {
return problemID;
}
return marker.getAttribute("id", PDEMarkerFactory.NO_RESOLUTION); //$NON-NLS-1$
}

via function hasResolution

public boolean hasResolutions(IMarker marker) {
return getProblemId(marker) > 0;
}

And in cases where it reaches to Line 164, where marker id is getting set with PDEMarkerFactory.NO_RESOLUTION, the Quick fix menu option gets disabled today as well. We just would have to work around similar way for other no quick fix available problems as well.

@laeubi
Copy link
Contributor

laeubi commented Feb 13, 2025

Then the title of the issue is misleading. PDE itself can't disable the menu, but it should report proper boolean hasResolutions(IMarker marker) for some of its problems.

@nburnwal09 nburnwal09 changed the title Disable the context menu option Quick fix for 'No fixes available' ones Suppress resolution if 'Configure problem severity' is the only available options Feb 13, 2025
@nburnwal09
Copy link
Author

nburnwal09 commented Feb 13, 2025

Yes, I agree. The underlying problem is that there are several markers where the problemID has the value PDEMarkerFactory.M_ONLY_CONFIG_SEV as the resolution, i.e., the "Configure problem severity" option only.
Instead of showing this in the quick fix dialog, the current implementation displays 'No quick fixes available.'

public IMarkerResolution[] getNonConfigSevResolutions(IMarker marker) {

case PDEMarkerFactory.M_CONFLICTING_AUTOMATIC_MODULE:
return new IMarkerResolution[] {
new RemoveRedundantAutomaticModuleHeader(AbstractPDEMarkerResolution.REMOVE_TYPE, marker) };
}
return NO_RESOLUTIONS;
}

To avoid misleading the user, one solution could be to return PDEMarkerFactory.NO_RESOLUTION for all such cases where the marker problemID only has PDEMarkerFactory.M_ONLY_CONFIG_SEV as the resolution.

In the future, we could implement an option to show 'Configure problem severity' along with the correct quick fix implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants