Bug 570774

Summary: [code mining] codeminings are placed too narrow / allow to specify padding
Product: [Eclipse Project] Platform Reporter: Christoph Laeubrich <laeubi>
Component: TextAssignee: Platform-Text-Inbox <platform-text-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3    
Version: 4.14   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Christoph Laeubrich CLA 2021-01-30 03:48:58 EST
Current behavior is the following:

I have a line for example

CodeMinings are cool


I now place one code mining 'very' after the 'e' the result is

CodeMinings arevery cool

I now place one code mining 'not' after the 'e' the result is

CodeMinings arevery | not cool

what I like to have is something like

CodeMinings are very cool
CodeMinings are very | not cool

My suggestion here would be to change the placing algorithm in the following way:
1) if the mining is the first (or only item) in the list and the preceding character is not a whitespace, add a whitespace infront
2) if the mining is the last (or only item) in the list and the next character is not a whitespace, add one afterwards


This behavior could be configurable via the ICodeMining itself (e.g. via a getSpacingStrategy()) to allow different plugable ways. I could even think about that one might wants something like this:

CodeMinings are [very|not] cool