kaleidawave / ezno

A fast and correct TypeScript type checker and compiler with additional experiments
https://kaleidawave.github.io/posts/introducing-ezno/
MIT License
2.55k stars 47 forks source link

Add watch mode support #202

Closed Tommypop2 closed 1 week ago

Tommypop2 commented 2 months ago

Closes #164

This PR is much bigger than I intended it to be, and clones data each time a file change is observed. This could possibly be removed by changing the underlying API, but I'm honestly not sure.

Also, on every individual file change, every file that matches the glob is recompiled. I did this for 2 reasons:

My current way of supporting the glob syntax is just by using the entry_points provided by get_entry_points. This seems to work pretty well, and reuses the work that needed to be done anyway to get the list of entry points. However, I'm not sure how efficient individually watching all the files is over many files.

If anything needs changing, let me know! Or if this approach is terrible I'm happy to close this

kaleidawave commented 2 months ago

Awesome, am back next week will have a closer look then.

Tommypop2 commented 2 months ago

Ok, thank you!

kaleidawave commented 2 months ago

Yes at the moment the checker doesn't support anything incrementally. In fact the web playground https://kaleidawave.github.io/ezno/playground and the LSP #22 run check_project on every keystroke (-some throttling). It can get away with it for the moment because the check process is fast. I want to work on some partial file and possible even local in a file rechecks, but it is quite low priority. So at the moment a watch mode that runs the check_project is good enough.

I will double check this and it will definitely be in the next release but that may be a while as currently a bit busy with things. Thanks for the addition though :)

kaleidawave commented 1 week ago

Have got it compiling under WASM now. Will merge it later.

I think a sort of "initial" version would be good to include in the next release. I can't think of a good way to add a test for it ATM