Bug 565534

Summary: [postifx] sysout/syserr postfix completion on variable
Product: [Eclipse Project] JDT Reporter: Mickael Istria <mistria>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: gautier.desaintmartinlacaze, jjohnstn, Lars.Vogel, rgrunber
Version: 4.16Keywords: usability
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Mickael Istria CLA 2020-07-25 03:29:25 EDT
I'd like to easily be able to insert a trace showing me that variable and its value.
Proposal: some .syserr and .sysout postfix completion on expressions, so that
`myVar.` could propose `syserr` as completion and then replace `myVar.` by `System.err.println("myVar=" + myVar)`; and similarly for expressions `someObject.getInfo().x.` could be replaced by `System.err.println("someObject.getInfo().x=" + someObject.getInfo().x)`.
Comment 1 Roland Grunberg CLA 2020-07-27 14:44:24 EDT
We currently have 'sysout' (but could also add a syserr) which works on an expression whose type is/returns String. We could probably lift this restriction to allow Objects and include the name of the expression as you've described. This would be a nice improvement to the current functionality.
Comment 2 Mickael Istria CLA 2020-07-28 02:59:06 EDT
Would it also be possible to add this for base types like int/float/char ?
Comment 3 Lars Vogel CLA 2020-08-18 05:42:46 EDT
(In reply to Roland Grunberg from comment #1)
> We could probably lift this restriction to allow Objects 

+1