Use supplied -javaagent param for lombok #253
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #240
What was noticed
The addLombokParam function does the resolution of the lombokJarPath. It does this by first scanning through the supplied params and removing any of the param that starts with -javaagent and ends with .jar. These are the javaagent declarations that are being made using "java.jdt.ls.vmargs" - the ones supplied by the user.
After this, the lomboxJarPath is resolved from the workspaceState here (looks hairy sort of). If that fails, it fallbacks to the extension's own lombok def, which in the real sense was not packaged with the extension, as it's meant to be located at {project}/lombok/lombok.jar.
So basically, the fallback does not exist and the one in the workspaceState does not exist either, meanwhile, the one supplied by the user using "java.jdt.ls.vmargs" has been thrown away. It wasn't even considered at all.
What was done
If perhaps a user has supplied a -javaagent param in "java.jdt.ls.vmargs", look through the ones that has been marked for deletion and cache the last one before deleting them.
Then try resolving from workspaceState (don't really know what that does, as the statement itself looks somewhat hairy @here), if that fails, extract the jar path from the user-supplied path and try resolving that. If it fails too, fallback to the extension's own lombok.