halcyon / asdf-java

A Java plugin for asdf-vm.
MIT License
455 stars 86 forks source link

Updated set-java-home.bash to only update if the working directory has changed #101

Closed Johnny-Malizia closed 4 years ago

Johnny-Malizia commented 4 years ago

Without this change, there is a very noticeable latency added to the terminal.

jmalizia-branch commented 4 years ago

@halcyon is there anything I need to do to help get this merged?

halcyon commented 4 years ago

@Johnny-Malizia much appreciated!

jmalizia-branch commented 4 years ago

No problem!

halcyon commented 4 years ago

LGTM!

halcyon commented 4 years ago

@Johnny-Malizia I just tried it out, and am a little concerned that this change does come with a trade off. Changing JDKs isn't directly related to changing one's working directory. It seems completely plausible to me that I might want to change JDKs and not change the working directory.

Johnny-Malizia commented 4 years ago

I understand and if you want to revert the change I'm ok with that. I think we can solve this by exporting the JAVA_HOME when the java binary is invoked by setting up exec-path to return the path, but also set the env var. This would add minimal latency to invoking the java binary, and remove the overhead from the shell_prompt.