Skip to content

Conversation

@heathhenley
Copy link
Collaborator

@heathhenley heathhenley commented Jan 11, 2025

First attempt at last part of #8

Kind of unrelated but in the docs it suggests to use Lazy.t instead of lazy_t https://ocaml.org/manual/5.3/api/Lazy.html (I don't know if there was a reason to use lazy_t - this is the first time I've used lazy so could be way off)

The issue that I see with this approach is that now we bat the 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 from read_file_contents - but I had some trouble getting to work right with lazy.

This is what it looks like:
image

@chshersh chshersh self-requested a review January 11, 2025 09:56
@chshersh chshersh added type: feature New feature request component: UI Issues related to changing UI labels Jan 11, 2025
Copy link
Owner

@chshersh chshersh left a 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.

Copy link
Owner

@chshersh chshersh left a 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! 🏆

Comment on lines +104 to +107
| File (name, contents) -> (
match Lazy.force contents with
| Fs.Text _ -> file_char ^ " " ^ pad name
| Fs.Binary -> bin_char ^ " " ^ pad name)
Copy link
Owner

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!

@chshersh chshersh merged commit af397bd into chshersh:main Jan 12, 2025
3 checks passed
@chshersh
Copy link
Owner

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 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: UI Issues related to changing UI type: feature New feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants