Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327027 - quickfix marker appears when there are no fixes available
Summary: quickfix marker appears when there are no fixes available
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 1.0.1   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-05 13:20 EDT by Henrik Lindberg CLA
Modified: 2017-10-31 10:57 EDT (History)
3 users (show)

See Also:
moritz.eysholdt: kepler+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henrik Lindberg CLA 2010-10-05 13:20:46 EDT
If there is a linking error, the DefaultQuickfixprovider.createLinkingIssueResolutions will create a QuickFix marker even if there are no quick fixes available. When clicked nothing happens and it looks like something is broken.

A quick fix marker should only be added if there is some quickfix to select.
Comment 1 Sebastian Zarnekow CLA 2010-10-05 14:36:09 EDT
The JavaDoc of IQuickAssistProcessor.canFix(Annotation) says the answer should be fast and optimistic: "It is ok return true even if there are no quickfixes available". That's what we do in DefaultQuickfixProvider.hasResolutionFor(String). I doubt that we can come up with a solution that is bulletproof and fast. Thus I'd like to close this one as won't fix. Do you have any concrete suggestions that would improve the situation?

Please note that clients are always free to customize #hasResolutionFor.
Comment 2 Sebastian Zarnekow CLA 2010-10-05 14:45:11 EDT
Please consider the following Java example.

import java.util.Arrays;

public class A {

  public static void foo() {
<lightbulb here>    new Arrays.ArrayList<String>();
  }

}

If you click the lightbulb in the gutter, you'll get a message "No suggestions available". Is this what you had in mind for Xtext based languages?
Comment 3 Henrik Lindberg CLA 2010-10-05 17:21:42 EDT
(In reply to comment #2)
> Please consider the following Java example.
> 
> import java.util.Arrays;
> 
> public class A {
> 
>   public static void foo() {
> <lightbulb here>    new Arrays.ArrayList<String>();
>   }
> 
> }
> 
> If you click the lightbulb in the gutter, you'll get a message "No suggestions
> available". Is this what you had in mind for Xtext based languages?

That is much better than nothing at all happening when there is a "quick fix marker". That nothing happens if there is no quick fix marker and user presses CTRL+1 for quick fix is also ok.

In my case, what was confusing was that there was both an error marker AND a quick fix marker at the same time - the error marker almost completely covered the quick fix marker.

The behavior is a bit odd - in a b3 editor if one types:
unit foo is Integer;

There is an error because a unit foo can not be an Integer. Change Integer to Integers, and there are now two errors, then backspace the extra "s", then type "s" again. As this goes back and forth, the error and quick fix markers trade z position. (Have not checked what the JDT does in the same situation).

When seeing the quick fix (for what appeared to be the same "error state"), and then nothing happening made me wonder - why did it tell me there was a quick fix all of a sudden when there were none...

A "No suggestions available" is a good enough solution.
Comment 4 Sven Efftinge CLA 2012-11-16 05:23:59 EST
has been fixed in the meantime.
Comment 5 Eclipse Webmaster CLA 2017-10-31 10:46:06 EDT
Requested via bug 522520.

-M.
Comment 6 Eclipse Webmaster CLA 2017-10-31 10:57:21 EDT
Requested via bug 522520.

-M.