Possible to add better PPX error messages

Hi there. I’m writing a ppx for a library I’m working on. The ppx parses a string, and I’d like to offer an explanation as to why parsing fails from within editors like vscode. Is this at all possible? For reference, this is the repository I’m working on: http://github.com/ncthbrt/reconstruct

Thank you

Since vscode uses merlin (afaik), just return normal error messages (either by inserting error nodes in the AST or by using Location.raise_errorf). merlin will report them, so you don’t need to duplicate your work for errors reported by editors or compiler.

The really important part is to give very good locations to your error messages.

1 Like

Oh. I didn’t know about error nodes. Thanks @Drup :slight_smile: