Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add toggle-reverse described in issue 16 #21

Merged
merged 5 commits into from
Nov 13, 2023
Merged

Conversation

Kotsuha
Copy link

@Kotsuha Kotsuha commented Nov 10, 2023

Describe the pull request

Implement the feature described in issue #16.

Screenshots

If applicable, add screenshots to help explain what is being modified.

toggle-reverse

This is draft. For example, I see there are test files. I did not write test for this new feature. Feel free to modify anything.

Kotsuha and others added 5 commits November 11, 2023 04:14
* main:
  Add job condition to integration workflow
  Add concurrency limit to integration workflow
  Add .gitattributes file
  Update vscodeignore
  Update vsce command
  Update dependencies
  Update various build dependencies
  Update integration workflow
@HiDeoo HiDeoo merged commit 00e4ee3 into HiDeoo:main Nov 13, 2023
3 checks passed
@HiDeoo
Copy link
Owner

HiDeoo commented Nov 13, 2023

Thanks for the contribution, super appreciated 🙌

This looks pretty straightforward and working as expected, I just added the following changes:

  • Refactor to use an explicit direction (forward or backward) instead of a boolean reverse flag.
  • Add a test to ensure it's working and properly loop back to the end of the list.
  • Update the CHANGELOG file.

Thanks again.

Copy link
Author

@Kotsuha Kotsuha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HiDeoo
Not sure if you'll see this but hey :D
I'd like to know your thought on this refactor commit. I just found myself writing similar code again in my project, and it reminds me of this commit made by you.

This is my code:

private void OnEditButtonClick()
{
    RequestOpenSession(true).Forget(); // <------ THIS LINE
}

private async UniTask RequestOpenSession(bool askPassword) // <------ THIS LINE
{
    // ...
}

askPassword sounds like a true or false, so I just use a boolean. But then the readability is not good. It's similar to this commit. I'd like to know if it's you who is writing the code, will you write it the other way?

Yes, I intentionally ask for a code review, sorry. You can ignore this message if you don't feel like it.

@HiDeoo
Copy link
Owner

HiDeoo commented Jan 13, 2024

Sorry for the late reply, did not see your message earlier.

I think there is a difference between your case and the one from this PR you linked. The direction explicitely had 2 options that be easily described (forward and backward) whereas in your case, it may not be that explicit with the use of a password or not.

It's difficult to say without knowing or writing the code, but my first guess would be, if this happens more than a few times, to not use RequestOpenSession(true) and maybe have an extra wrapper function, e.g. RequestOpenSessionWithPassword() which would be way more explicit for the reader of the code that would call the underlying function with the correct parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants