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).
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).