-
-
Notifications
You must be signed in to change notification settings - Fork 16
Use binary icon for binary file types #15
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
Conversation
chshersh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff! Left a few comments and suggestions on how to improve things.
Co-authored-by: Dmitrii Kovanikov <[email protected]>
chshersh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @heathhenley,
Impressive work!
Indeed, I do like the new shape of file_contents more as it better reflects the actual underlying model.
Indeed, the code became slightly more complex. I have a few ideas on how to fix that but I propose to handle them under separate refactoring issues.
Thanks for implementing this feature! 🏆
| | File (name, contents) -> ( | ||
| match Lazy.force contents with | ||
| | Fs.Text _ -> file_char ^ " " ^ pad name | ||
| | Fs.Binary -> bin_char ^ " " ^ pad name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how it looks, this is pretty neat!
|
Hey @heathhenley, I made a couple of follow-up refactoring issues to decrease some tech debt:
Feel free to grab them in no particular order 🙂 |
First attempt at last part of #8
Kind of unrelated but in the docs it suggests to use
Lazy.tinstead oflazy_thttps://ocaml.org/manual/5.3/api/Lazy.html (I don't know if there was a reason to uselazy_t- this is the first time I've usedlazyso could be way off)The issue that I see with this approach is that now we
batthe files twice - maybe that's ok? If not let me know if you see a way to set it up so that it's lazily evaluated when either contents or type is needed, but they both get set when that happens. I tried returning a tuple fromread_file_contents- but I had some trouble getting to work right withlazy.This is what it looks like:
