pest-parser / site

This repo contains the source code for https://pest.rs
http://pest.rs/
Apache License 2.0
12 stars 16 forks source link

Allow a selection of text to be parsed in the playground #60

Open NickLarsenNZ opened 1 week ago

NickLarsenNZ commented 1 week ago

Currently the whole text is parsed, which means when debugging single rules, you have to keep deleting and re-adding sections of the input text.

It would be really nice to be able to select lines to parse, so that the text input can stay relatively static while you work on the grammar rules.

image

It would be super cool if it worked the same as Github selections (where you can click a line number, hold SHIFT, then click another line number - and the URL also has a selection fragment like #L7-L15).

tomtau commented 1 week ago

@LeoDog896 @nathanielknight any thoughts?

LeoDog896 commented 1 week ago

CodeMirror doesn't have any explicit plugins for gutter-based line selection, I believe, so there would have to be a home-baked solution. Optionally, it could be based on the selected text in the editor, but that would be much more finicky. I would put the gutter selection inside the share string, though, instead of its own separate hash.

tl;dr the base feature sounds good :+1:

nathanielknight commented 1 week ago

I like the idea, but I agree that the implementation would be tricky. It might be easier to replace the editor with a stack of editors and let you break up your text that way instead?