Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error reporting localisation with HLS #35

Open
guibou opened this issue Feb 27, 2024 · 1 comment
Open

Improve error reporting localisation with HLS #35

guibou opened this issue Feb 27, 2024 · 1 comment

Comments

@guibou
Copy link

guibou commented Feb 27, 2024

The error reporting of this library is awesome, thank you!

However, it does not integrate well with HLS. Any error span the complete quasi quote AND the customerror message localization with custom caret is integrated in the error message, leading to a lot of clutter.

See for example:

image

In comand line we get:

[1 of 2] Compiling Main             ( Main.hs, Main.o, Main.dyn_o )

Main.hs:40:19: error:
    • 3:9:
  |
3 |     fom "user"
  |         ^
unexpected '"'
expecting end of input or white space

    • In the quasi-quotation:
        [maybeStatement|
    select name :: text, email :: text, phone :: text?
    fom "user"
    where id = $1 :: int4
    |]
   |
40 |   [maybeStatement|
   |       

However, it is possible to give precise localization position in quasi quote using a small trick. See my implementation in PyF here:

https://hackage.haskell.org/package/PyF-0.11.2.1/docs/src/PyF.Internal.QQ.html#reportErrorAt

@nikita-volkov
Copy link
Owner

Thanks for the suggestion. PR is welcome. Unfortunately I won't have the time to implement this myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants