jdt-codemining icon indicating copy to clipboard operation
jdt-codemining copied to clipboard

New codemining: Show errors

Open enikao opened this issue 6 years ago • 11 comments

Errors are marked with red squiggly lines and in the sidebar. However, I still have to hover with the mouse to actually read the issue. A codemining could show this inline, maybe with an upper limit ("only show errors if less than x errors in file").

Obviously, we could do the same for other markers. IMHO, this should definitely be configurable separately. Some codebases don't care about warnings, and there are cases where you can't get rid of some markers.

enikao avatar Jul 04 '18 10:07 enikao

We need to try the renderer of the feature. I don't know if it's an hard thing to do.

angelozerr avatar Jul 05 '18 11:07 angelozerr

+1

vogella avatar Oct 18 '18 07:10 vogella

We need to try the renderer of the feature

Which renderer? What makes this suggested code mining different from other ones?

mickaelistria avatar Oct 22 '18 13:10 mickaelistria

@enikao started to work on this today during EclipseCon Europe Unconference. Here is the diff https://gist.github.com/mickaelistria/2aae7cc18cb52c1acb17c64cfbe62129 Here is how it looks like in the generic editor screenshot from 2018-10-22 17-14-11

mickaelistria avatar Oct 22 '18 15:10 mickaelistria

Created Eclipse Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=540443 Working on it at https://github.com/enikao/eclipse.platform.text/blob/Bug_540443/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ProblemMarkerCodeMiningProvider.java

enikao avatar Oct 24 '18 16:10 enikao

Thanks @enikao !

angelozerr avatar Oct 24 '18 19:10 angelozerr

I replaced the unicode symbols by icons (as proposed by @vogella): image

Outstanding issues:

  • I currently re-use the icons from org.eclipse.ui.internal.ide.IDEInternalWorkbenchImages. What's the right thing to do here? Ignore the warnings? Copy the icons?
  • If there's more than one marker at one line, they appear at the same line (IMHO, that's a general code mining issue). However, the text of the first entry is cut off by the number of pixels I reserved for the icon.
  • Do I need to translate the exception messages in e.g. https://github.com/enikao/eclipse.platform.text/blob/Bug_540443/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ProblemMarkerCodeMining.java#L93 ?
  • How to handle monitor.isCancelled() in streams? This looks rather strange: https://github.com/enikao/eclipse.platform.text/blob/Bug_540443/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/ProblemMarkerCodeMiningProvider.java#L84

enikao avatar Oct 26 '18 14:10 enikao

@enikao your work is very cool, but it is not linked to JDT CodeMining. I suggets you that you post your question https://bugs.eclipse.org/bugs/show_bug.cgi?id=540443 and as @vogella suggested to provide a gerrit patch. Thanks!

angelozerr avatar Oct 26 '18 14:10 angelozerr

Also you should use line minings instead of header minings, the error messages should be in the same line as the error marker

Angelo [email protected] schrieb am Fr., 26. Okt. 2018, 16:48:

@enikao https://github.com/enikao your work is very cool, but it is not linked to JDT CodeMining. I suggets you that you post your question https://bugs.eclipse.org/bugs/show_bug.cgi?id=540443 and as @vogella https://github.com/vogella suggested to provide a gerrit patch. Thanks!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/angelozerr/jdt-codemining/issues/57#issuecomment-433433707, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIihoG1HRuYe_yTjsYF-9UXE7zjOlyCks5uoyC_gaJpZM4VCXPb .

vogella avatar Oct 26 '18 14:10 vogella

Thanks for the hint @angelozerr, I'll continue the discussion there.

enikao avatar Oct 26 '18 15:10 enikao

There is actually one aspect regarding JDT. The Java editor also shows the minings, without any changes outside the generic editor: image In this screenshot, I just entered "asdfasdfads" + ENTER. Clearly, the result is not really what we expected (line 6 should not have a line number, misses the icons, and is wrongly indented. Also, it should be above line 8, not line 7. the "return void" error is there twice at wrong positions).

org.eclipse.jdt.ui version is 3.15.0.v20180829-2215

enikao avatar Oct 26 '18 16:10 enikao