rnix-parser icon indicating copy to clipboard operation
rnix-parser copied to clipboard

More helpful error messages

Open aaronjanse opened this issue 3 years ago • 3 comments

It would be great if rnix-parser has errors more descriptive than "unexpected X," perhaps prompting the user how to fix the code if we can guess what's missing (e.g. a semicolon for the last value in an attr set)?

Existing error messages at the time of writing:

https://github.com/nix-community/rnix-parser/blob/fa6dddecb848f813e7973be3d82ad8666e98eb8e/src/parser.rs#L22-L37

aaronjanse avatar Nov 11 '21 18:11 aaronjanse

Seems reasonable. Will be out of scope for 0.10. though, hope that's OK :)

Ma27 avatar Nov 11 '21 18:11 Ma27

In case someone wants to take over, feel free.... Otherwise I'll look into it as soon as we're working on 1.0.

Ma27 avatar Nov 11 '21 18:11 Ma27

Just to be clear, this is about improving the Display impl for ParseError? As in expanding on the strings

See https://github.com/nix-community/rnix-parser/blob/01e65829a56b772ad37881ab51680ff8fcd45de3/src/parser.rs#L43-L79

elikoga avatar Jan 25 '23 12:01 elikoga