manishshettym / codescholar

codescholar: growing programs graphs idiomatically for API usage examples
10 stars 0 forks source link

Improve saving, presenting, and rendering idioms #24

Closed manishshettym closed 8 months ago

manishshettym commented 8 months ago

Current status: A lot of the presentation aspects can be covered using the original program graph (accessible via the index) from which this idiom was extracted.

✅ On graph side: idiom subgraph can be highlighted within the original graph ❌ On prog side: idiom sub-prog cannot be highlighted easily within the original prog, in a simple .py file.

Current solution: don't eagerly render idiomatic programs during search. Just store the metadata that can be easily transferred (even streamed) to a front-end and rendered using javascript more fancily (instead of within a .py file)

Metadata format: JSON Metadata schema:

https://github.com/tart-proj/codescholar/blob/28fd0a34ebc55d8370558db1f487a1866dce2f94/codescholar/search/search.py#L60-L69

manishshettym commented 8 months ago

Update: ✅ idiom sub-prog can be highlighted using the saved metadata on the HTML application.

TODO: there's a fix required to do this without breaking some newlines in the rendered code when used with syntax highlighters.

manishshettym commented 8 months ago

Update: fixes have been made, and the viz is in good shape now!

manishshettym commented 8 months ago

Updates: Improved the UX to work with codescholar application and also using the streamlit app

  1. Quick shell scripts to startup the services and application
  2. UX now waits until the search is complete and shows the polling
  3. The cache updates the dropdown automatically