BetterErrors / better_errors

Better error page for Rack apps
MIT License
6.88k stars 437 forks source link

Allow loading more code into the trace_info box #370

Open zedtux opened 7 years ago

zedtux commented 7 years ago

The trace_info box is nice but miss a way to load some more code.

The ideal world would be that the trace_info shows the current method definitions, the hidden code replaced with suspension points, then the current code as it is now, the rest of the method code hidden with suspension points and then end of the current method.

The suspension points could be replaced by an expand icon, be clickable so that the reste of the code is loaded. This is the way github do in diff

screen shot 2017-04-25 at 10 44 30

zedtux commented 6 years ago

Any news on this issue?

RobinDaugherty commented 6 years ago

It sounds like an interesting improvement. If you want to open a pull request for it, please go ahead.

On the other hand, since Better Errors includes link to your editor for the specific file and line, this may not be worth the effort. Since the tool is designed to be used only locally in development, I'm not sure of a scenario where the expanding code sections would be much more useful than the editor link.

RobinDaugherty commented 6 years ago

This may also reinforce the suggestion to improve the visibility of the editor link (#383).

zedtux commented 6 years ago

On the other hand, since Better Errors includes link to your editor for the specific file and line, this may not be worth the effort. Since the tool is designed to be used only locally in development, I'm not sure of a scenario where the expanding code sections would be much more useful than the editor link.

Well when you have an error, and better errors shows up, you start to debug and look around, I don't see how it is practical to switch between better errors and your IDE ... Otherwise Github would have the same idea and wouldn't have implemented the feature to see more code.

Regarding the link to the IDE, I need to check but as far as I remember I never got it working with Atom (and I never spent a lot of time). It's always best to have working solution out-of-the-box :) And I truly believe that my feature request will improves the way developers work with better errors (the IDE redirection link will be useful when the dev is done with debugging and wants to fix it.)

zedtux commented 6 years ago

@RobinDaugherty the Pull Request is now ready, tests and coverage should pass, and I put some screenshots in the PR.

Please feel free to review my code and post your comments and merge it :)