tom-and-the-toothfairies / pathways

:older_woman: :hospital: :pill: :pill:
https://tomandthetoothfairies.info/
5 stars 0 forks source link

generic error highlight generation #167

Closed 22a closed 7 years ago

22a commented 7 years ago

I've added a function that takes a source file and a line number (and optionally a number to indicate the number of surrounding lines to display above and below the highlighted line), and returns a pre-formatted DOM element.

It looks like this:

screen shot 2017-03-25 at 03 49 02

To show it in use I've modified the displayClashes and displayUnnamed view functions to use it, those look like this:

screen shot 2017-03-25 at 03 48 29

I've done it this way to try and decouple the error highlighting logic from the bootstrap panels in order to make it easy to port to whatever UI we decide to go with because I don't like how it looks at the moment, much too bulky.

22a commented 7 years ago

ah ye, I've snapped a cucumber, will fix in the morning

22a commented 7 years ago

I've changed it so that the pml file is pulled from the file input, should correct any line number errors caused by the PML-TX parsing stripping comments / whitespace.

This brought up the discussion that it may be worthwhile decommissioning the AST->PML endpoint entirely in favour of triggering the file download with the original file provided by the user. We had some dirty code to do that a few pr's ago: https://github.com/tom-and-the-toothfairies/pathways/blob/6dbda89fe1e3c1507770d37d22c3a3ad41a1077e/panacea/web/static/js/app.js#L122-L130 which would work now that we have the raw file contents again.