frugel icon indicating copy to clipboard operation
frugel copied to clipboard

Cursor is moved back after writing ... in a construction site

Open cdfa opened this issue 4 years ago • 0 comments

When we use the empty construction site syntax ... in a construction site that contains a syntax error (e.g. (...), the cursor is moved back 3 spaces. This happens because the editor needs to account for the disappearance of the 3 dots when they are replaced by a 0-width empty construction site, but it's erroneously also doing this when the parsing of the construction site with the 3 dots fails.

To fix this, we need to add custom state to the parser that backtracks when a parse fails (as described in the Megaparsec tutorial).

cdfa avatar Feb 07 '22 14:02 cdfa