asdf-java icon indicating copy to clipboard operation
asdf-java copied to clipboard

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

Open rexk opened this issue 5 years ago • 6 comments

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

rexk avatar Jul 07 '20 23:07 rexk

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

halcyon avatar Jul 30 '20 19:07 halcyon

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.

sqtran avatar Jul 30 '20 20:07 sqtran

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?

halcyon avatar Jul 30 '20 20:07 halcyon

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.

sqtran avatar Jul 30 '20 20:07 sqtran

@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?

rexk avatar Jul 30 '20 20:07 rexk

@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

halcyon avatar Jul 31 '20 15:07 halcyon