Generate toString() source action should support inclusion of methods
It would be helpful to add an option to generate a toString with getters instead of attribute names because it would allow the toString to work automatically in subclasses where the getters might be overridden. Currently, the dialog only allows you to select which attributes to include in the toString. It seems like it would be relatively simple to add a checkbox (or maybe a separate dialog box) that allows the user to select whether to use attribute names or getters.
I think this is possible with just adjusting how we use the GenerateToStringOperation and its underlying API. From Eclipse IDE, I see :

We don't need to support all of these, but clearly generation from methods is supported. Also, in case anyone is interested, here is where we set defaults for most of these settings : https://github.com/eclipse/eclipse.jdt.ls/blob/a33760778e3c6e5433cde02f45cba972e6c20159/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/GenerateToStringHandler.java#L115 .
Update :
- At https://github.com/eclipse/eclipse.jdt.ls/blob/a33760778e3c6e5433cde02f45cba972e6c20159/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/GenerateToStringHandler.java#L81 , we only gather all fields, and not methods for the quick-pick prompt. It's easy enough to get all methods from a given
IType(we have have theITypeBinding!). - From the vscode-java side, the code needs to change so the quick-pick can display the methods being considered : https://github.com/redhat-developer/vscode-java/blob/60b41ea8d8d2f6f7b53eb4a2ba506a507d2d0d30/src/sourceAction.ts#L184-L202
Once all of that is done, https://github.com/eclipse/eclipse.jdt.ls/blob/a33760778e3c6e5433cde02f45cba972e6c20159/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/GenerateToStringHandler.java#L149 is where the selected members get passed in for the toString() method generation. Although we pass in just fields, the javadoc clearly indicates it can accept a member.