-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Customize error output format? #865
Comments
I'll add the line and column number after the file name like this:
I'd really rather not add another command-line flag. If this approach is still troublesome, I recommend using esbuild's API instead which returns log messages as an array of objects. You can easily use the API to write a wrapper script that formats the log messages however you like. |
This is great, thank you! |
For anyone who gets here after googling for "Emacs esbuild compilation regex", here's what I ended up setting up (to ignore the whitespace at the beginning of errors and have the right path be captured). (For esbuild people: Emacs' compilation mode scans the output for errors. Most tools will put filename:line:col, without any whitespace in the front of the error. the whitespace in front of the default esbuild output ends up getting interpreted as the start of the line, which messes with the file lookup)
|
Would you be amenable to having the output format for errors be customizable?
In Emacs, when you run a compilation command, it parses the output and if it sees something that looks like a filename and line number, it uses that info to let you jump to the location of the error.
You can customize the regex that it uses to look for these, but you can't easily use a multiline regex. This means it's hard to get this to work with ESBuild, which spreads the file and line number info over several lines:
It would be good to get a one-line, "machine-readable" error output option. For example:
I have hacked my personal copy of esbuild thus:
If I made this nice and put it behind a command-line option like "--error-format=compact" or something, would you be likely to accept it?
The text was updated successfully, but these errors were encountered: