Glavin001 / Glavin001/atom-preview
Preserve line-breaks in compiler error messages
- Dominant language
- CoffeeScript
- Stars
- 51
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
Searched briefly but didn't see this one - apologies if I overlooked it.
I was playing last night and pretty easily added a renderer for LispyScript (which I've been enhancing recently), but one thing I couldn't resolve was that I'd recently made the LispyScript error messages do the thing where it displays the source line of the error, then displays a second line that puts a "^" beneath the column position of the error (imitating how node displays errors).
This error format displays poorly in atom preview, and I notice CoffeeScript's error messages are hard to read for the same reason (it uses that same "^" formatting).
It reads funky because:
```
a. the error message is center aligned not left aligned
b. multi-line error messages are run together i.e. line-breaks/carriage returns are not displayed (I assume because the error is treated as a string and made the text of a dom element?).
```
I addessed "a." pretty easily with a setting in my ~/.atom/styles.less file:
```
.text-error { text-align: left; font-size: 22px }
```
But b. seems a bigger question that will need a code change I'm guessing.
Would people be open to an enhancement to address this? I haven't looked too closely but I'm guessing it might be an easy change I could give it a shot and do a pull request if people are interested.
e.g. maybe a bit of code could be added that snoops the error message for \n and if it finds them replaces them with <br/>, sets that as innerHtml, and changes the css class to use left alignment instead of center?
Or do people think this would mess too much with the formatting of the existing languages?
(I admit it's really just LispyScript and CoffeeScript I've played with in atom preview so far).
Thanks,
Darren
Contributor guide
No contributing guide indexed for this repository
Research direction
No file or test is named; start by locating the Atom preview error-rendering entry point and reproduce the issue with CoffeeScript or LispyScript errors containing line breaks. Done means multiline error messages display on separate lines while existing language error formatting remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- coffeescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100