{"id":436,"date":"2019-05-27T00:11:09","date_gmt":"2019-05-26T22:11:09","guid":{"rendered":"https:\/\/www.nikostotz.de\/blog\/?p=436"},"modified":"2019-05-27T00:11:09","modified_gmt":"2019-05-26T22:11:09","slug":"inline-display-of-error-warning-info-annotations-in-eclipse","status":"publish","type":"post","link":"https:\/\/www.nikostotz.de\/blog\/inline-display-of-error-warning-info-annotations-in-eclipse\/","title":{"rendered":"Inline Display of Error \/ Warning \/ Info Annotations in Eclipse"},"content":{"rendered":"\n<p><strong>tl;dr:<\/strong> A prototype implementation shows all error, warning, and info annotations (&#8220;bubbles&#8221; in the left ruler) in Eclipse Java editor as inline text. Thus, we don&#8217;t have to use the mouse to view the error message. The error messages update live with changes in the editor.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"834\" height=\"272\" src=\"https:\/\/www.nikostotz.de\/blog\/wp-content\/uploads\/2019\/05\/InlineAnnotationsSmall.gif\" alt=\"\" class=\"wp-image-438\"\/><figcaption>Screencast showing the live effect<\/figcaption><\/figure>\n\n\n\n<p>I&#8217;m an avid keyboard user. If I have to touch the mouse, something is wrong. Eclise has tons of shortcuts to ease your live, and I use and enjoy them every day.<\/p>\n\n\n\n<p>However, if I had an error message in e.g. my Java file, and I couldn&#8217;t anticipate the error, I had several bad choices:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li> Opening the <em>Problems<\/em> view and navigating to the current error (entries in the  Problems view are called &#8220;markers&#8221; by Eclipse)<\/li><li>Moving the mouse over the annotation in the left ruler (&#8220;annotation&#8221; in Eclipse lingo)<\/li><li>Guessing<\/li><\/ul>\n\n\n\n<p>Not so long ago, Angelo Zerr and others implemented <a href=\"https:\/\/github.com\/angelozerr\/jdt-codemining\">code mining<\/a> in Eclipse. This feature displays additional information within a text file without changing the actual contents of the file. Sounds like a natural fit for my problem!<\/p>\n\n\n\n<p>I first tried to implement the error code mining based on markers, (<a href=\"https:\/\/bugs.eclipse.org\/bugs\/show_bug.cgi?id=540443\">Bug 540443<\/a>). This works in general. However, markers are bound to the <em>persisted state<\/em> of a file, i.e. how a file is saved to disk. So they are only updated on saving.<\/p>\n\n\n\n<p>Most editors in Eclipse are more interactive than that: They update their error information based on the <em>dirty state<\/em> of the editor, i.e. the text that&#8217;s currently in the editor. This feels way more natural, so I tried to rewrite my error code mining based on annotations. The current prototype is shown in above&#8217;s screencast.<\/p>\n\n\n\n<p>The code is attached to <a href=\"https:\/\/bugs.eclipse.org\/bugs\/show_bug.cgi?id=547665\">Bug 547665<\/a>. The prototype looks quite promising.<\/p>\n\n\n\n<p>As above&#8217;s screencast shows, I have at least one serious issue to resolve: When the editor is saved, all code minings briefly duplicate. Thankfully, they get back to normal quickly.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>tl;dr: A prototype implementation shows all error, warning, and info annotations (&#8220;bubbles&#8221; in the left ruler) in Eclipse Java editor as inline text. Thus, we don&#8217;t have to use the mouse to view the error message. The error messages update live with changes in the editor. I&#8217;m an avid keyboard user. If I have to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-436","post","type-post","status-publish","format-standard","hentry","category-eclipse"],"_links":{"self":[{"href":"https:\/\/www.nikostotz.de\/blog\/wp-json\/wp\/v2\/posts\/436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nikostotz.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nikostotz.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nikostotz.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nikostotz.de\/blog\/wp-json\/wp\/v2\/comments?post=436"}],"version-history":[{"count":3,"href":"https:\/\/www.nikostotz.de\/blog\/wp-json\/wp\/v2\/posts\/436\/revisions"}],"predecessor-version":[{"id":441,"href":"https:\/\/www.nikostotz.de\/blog\/wp-json\/wp\/v2\/posts\/436\/revisions\/441"}],"wp:attachment":[{"href":"https:\/\/www.nikostotz.de\/blog\/wp-json\/wp\/v2\/media?parent=436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nikostotz.de\/blog\/wp-json\/wp\/v2\/categories?post=436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nikostotz.de\/blog\/wp-json\/wp\/v2\/tags?post=436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}