-
Notifications
You must be signed in to change notification settings - Fork 66
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
How to use source map? #278
Comments
I've labelled this In the meantime, see if |
Thank you with |
I'm going to leave this issue as documentation, then start a new issue for getting the inline output out of the API. In the meantime, this is roughly what the CLI is doing: const res = peggy.generate("foo = 'foo'", {
output: "source-and-map",
});
const sourceMap = res.toStringWithSourceMap();
const json = sourceMap.map.toJSON();
const buf = Buffer.from(JSON.stringify(json));
console.log(sourceMap.code + `\
//\x23 sourceMappingURL=data:application/json;charset=utf-8;base64,${buf.toString("base64")}
`); |
Thank you. My issue has been resolved and I was able to use breakpoints in the generated code. |
I implemented the source map feature, but I was unable to set breakpoints in the pegjs file which would stop the program (using webstorm). Also, my collaborator was unable to find someone who knows how to use the generated map file in a node.js context.
Is there some general interest in understanding how the generated maps can be used in IDEs? I think it would be helpful to have a step by step guide on how to use the maps in the examples so that one can differentiate if the generated map was faulty or if the IDE does not support that feature.
The text was updated successfully, but these errors were encountered: