Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 540865 - [Code Mining] LineHeaderCodeMining above empty line does not work
Summary: [Code Mining] LineHeaderCodeMining above empty line does not work
Status: CLOSED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.8   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-07 03:16 EST by Marcus Höpfner CLA
Modified: 2022-02-06 15:26 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcus Höpfner CLA 2018-11-07 03:16:20 EST
It is not possible to create a LineHeaderCodeMining above an empty line (a line without any visible character, just the line break). LineHeaderCodeMining is not visible.
Especially if the last line of the document is an empty line. In this case a BadLocationException is thrown in  AbstractDocument.addPosition.
Guess it is due to the creation in LineHeaderCodeMining constructor which uses Positions.of(int, document, boolean).
In the case of the last empty line it creates a Position with the offset of the last line and length = 1. This is after the end of the document.
If this BadLocationException is thrown, it may be that other LineHeaderCodeMinings are not shown as well. Probably due to the BadLoacationException.
Comment 1 Alexander Fedorov CLA 2018-11-10 05:44:29 EST
I have similar problem with Target Definition source editor (Bug 534758)

For the content like 
"
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="some.target">
</target>
"

LineHeaderCodeMining with beforeLineNumber<2 disappers after change in editor
Debugging shows that it goes more or less good till the CodeMiningLineContentAnnotation.redraw call
Comment 2 Mickael Istria CLA 2022-02-06 15:26:56 EST
I just tested and that is now working, I suspect thanks to fixes for bug 539624