feat: add ability to annotate errors and warnings
Closes #70
I've took the liberty to open a pr for my feature request. It was a bit of hard to figure out a good UX for this but i think overall is not bad:
https://github.com/user-attachments/assets/d0a2edcc-aa1e-4f07-8bec-34ccfd391fc8
You can select portion of the text and press E or W to add an error/warning...the C button clears all the errors and warnings ~(it would be cool to have the ability to clear only a specific one but I wonder how that would look like (maybe if there's a selection only removes the ones in the selection?)~ actually i just updated the PR to do exactly this
Here's the resulting image.
Some notes
- I needed access to the editor textarea within the footer...not sure what the best practice for this is in vue but i resorted to setting context in Window and accessing it both from the editor and the footer. I've used a pattern we use quite often in svelte to create typesafe contexts.
- I had to create a shiki transformer for this, this adds an extra div to only show the squiggles...this does mean some extra elements but i think it's fine
- I had to update the persisted store to store the marks, i did it in a back compatible way so it shouldn't cause trouble
Let me know if there's something you wish to change (and thanks for this awesome tool)
@paoloricciuti Thanks for PR! What you think about putting it in toolbar which shows when you select text?
@paoloricciuti Thanks for PR! What you think about putting it in toolbar which shows when you select text?
Mmm this might be a good idea... I'll check how feasible it is to do...would you also put the clear there? I think have a clear all would still be good and that should be always on without the need to select text
Pushed a change to move the buttons in the toolbar...I did something like this but if you have suggestions in terms of styling feel free to ping 😄
Hey @Idered any chance for this to be merged?
