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

Source mapping for Inliterate #31

Open
NickSeagull opened this issue Aug 2, 2017 · 6 comments
Open

Source mapping for Inliterate #31

NickSeagull opened this issue Aug 2, 2017 · 6 comments

Comments

@NickSeagull
Copy link

I was thinking that maybe it would be useful to have source maps generated by inliterate so in case of error, one could parse it, look into the source map file and replace it so the user could see where the real errors are instead of random numbering 😃 .

Does this make sense for you? I'm thinking about implementing error highlighting in Haskell.do, but without this it would be very difficult.

I would be willing to help with this 😁

@glutamate
Copy link
Member

Is this possible? Can you link to GHC doc page if so?

@NickSeagull
Copy link
Author

I'm not really sure if this is possible, it was just an idea that maybe could make sense, I was thinking about hand parsing both files, the source and the generated, and try to find the line with an error from the generated one in the source. Might not cover all the use cases, but I think it could be a start

@vasiliyl
Copy link
Contributor

This should be possible using GHC's LINE and COLUMN pragmas: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#line-pragma

@NickSeagull
Copy link
Author

@vasiliyl ⬆️ this looks quite promising. @glutamate would you like to have me submit a pull request for this? If so, could you please point me where the code generation is made so I can add these pragmas?

@glutamate
Copy link
Member

@vasiliyl @NickSeagull i agree this is the way to go. Right now everything is parsed by cheapskate with its markdown and i dont think its Doc type preserves the source line location? but cheapskate could be replaced, there are many haskell markdown parsers. I would be reluctant to change to a GPL licensed parser though.

@NickSeagull
Copy link
Author

@glutamate agree 100% with the GPL decision

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

3 participants