halcyon / asdf-java

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

Update set-java-home.zsh to check directory change #102

Open rexk opened 4 years ago

rexk commented 4 years ago

Update set-java-home.zsh to only update if the working directory has changed. This will prevent unnecessary java_home update.

halcyon commented 4 years ago

What if one changes JDKs but does not change the working directory? Why should JAVA_HOME not be updated in this case?

sqtran commented 4 years ago

This would most likely behave the same way as the bash script version. Workaround would be to just cd out and back in.

Reducing the # of times JAVA_HOME gets checked significantly reduces shell lag. I don't have a mac to see how zsh behaves, but the lag was very noticeable in bash before the latest update.

halcyon commented 4 years ago

This would most likely behave the same way as the bash script version. Workaround would be to just cd out and back in.

Reducing the # of times JAVA_HOME gets checked significantly reduces shell lag. I don't have a mac to see how zsh behaves, but the lag was very noticeable in bash before the latest update.

I find it just as concerning in the bash script version as I do in this one. Are you using Windows or Linux?

sqtran commented 4 years ago

This would most likely behave the same way as the bash script version. Workaround would be to just cd out and back in. Reducing the # of times JAVA_HOME gets checked significantly reduces shell lag. I don't have a mac to see how zsh behaves, but the lag was very noticeable in bash before the latest update.

I find it just as concerning in the bash script version as I do in this one. Are you using Windows or Linux?

Linux. Verified the behavior exists on both Fedora 32 and RHEL 7.5.

rexk commented 4 years ago

@halcyon Perhaps we can set some another environment variable to notify if JDK as changed with asdf command. So that we can short circuit the operation?

halcyon commented 4 years ago

@halcyon Perhaps we can set some another environment variable to notify if JDK as changed with asdf command. So that we can short circuit the operation?

Sounds promising. I think @Johnny-Malizia is trying something along those lines in #106